From 70e742ae6cd5e85059a1b8efec00c46d5c54a7f1 Mon Sep 17 00:00:00 2001
From: Jean-Noël Rouvignac <jean-noel.rouvignac@forgerock.com>
Date: Thu, 28 Jan 2016 08:28:53 +0000
Subject: [PATCH] (PR-201) Do not call String.toLowerCase() or StaticUtils.toLowerCase() since Schema class now does it itself
---
opendj-server-legacy/src/main/java/org/opends/server/core/DirectoryServer.java | 8 -
opendj-server-legacy/src/main/java/org/opends/server/authorization/dseecompat/AciEffectiveRights.java | 6
opendj-server-legacy/src/main/java/org/opends/server/authorization/dseecompat/PatternRDN.java | 12 +-
opendj-server-legacy/src/main/java/org/opends/server/core/SubentryPasswordPolicy.java | 2
opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/TableViewEntryPanel.java | 11 -
opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/ViewEntryPanel.java | 12 -
opendj-server-legacy/src/main/java/org/opends/server/admin/AttributeTypePropertyDefinition.java | 8 -
opendj-server-legacy/src/test/java/org/opends/server/backends/pluggable/PluggableBackendImplTestCase.java | 4
opendj-server-legacy/src/test/java/org/opends/server/replication/plugin/FractionalReplicationTest.java | 19 +--
opendj-server-legacy/src/test/java/org/opends/server/replication/plugin/ModifyConflictTest.java | 3
opendj-server-legacy/src/main/java/org/opends/server/plugins/ReferentialIntegrityPlugin.java | 6
opendj-server-legacy/src/main/java/org/opends/server/backends/pluggable/VLVIndex.java | 4
opendj-server-legacy/src/main/java/org/opends/server/plugins/AttributeCleanupPlugin.java | 4
opendj-server-legacy/src/main/java/org/opends/server/backends/pluggable/EntryContainer.java | 4
opendj-server-legacy/src/main/java/org/opends/server/types/Entry.java | 15 +-
opendj-server-legacy/src/test/java/org/opends/server/admin/ValidateConfigDefinitionsTest.java | 4
opendj-server-legacy/src/test/java/org/opends/server/core/SubentryManagerTestCase.java | 12 +-
opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/SimplifiedViewEntryPanel.java | 83 ++++++----------
opendj-config/src/test/java/org/forgerock/opendj/config/ValidateConfigDefinitionsTest.java | 2
opendj-server-legacy/src/main/java/org/opends/server/controls/ServerSideSortRequestControl.java | 19 ++-
opendj-server-legacy/src/main/java/org/opends/server/backends/task/RecurringTask.java | 11 -
21 files changed, 106 insertions(+), 143 deletions(-)
diff --git a/opendj-config/src/test/java/org/forgerock/opendj/config/ValidateConfigDefinitionsTest.java b/opendj-config/src/test/java/org/forgerock/opendj/config/ValidateConfigDefinitionsTest.java
index c11cf5a..b093da3 100644
--- a/opendj-config/src/test/java/org/forgerock/opendj/config/ValidateConfigDefinitionsTest.java
+++ b/opendj-config/src/test/java/org/forgerock/opendj/config/ValidateConfigDefinitionsTest.java
@@ -173,7 +173,7 @@
}
Schema schema = Schema.getDefaultSchema();
- AttributeType attrType = schema.getAttributeType(ldapAttrName.toLowerCase());
+ AttributeType attrType = schema.getAttributeType(ldapAttrName);
// LDAP attribute exists
if (attrType == null) {
diff --git a/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/SimplifiedViewEntryPanel.java b/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/SimplifiedViewEntryPanel.java
index 3e1b8f3..6fbf5d0 100644
--- a/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/SimplifiedViewEntryPanel.java
+++ b/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/SimplifiedViewEntryPanel.java
@@ -80,6 +80,7 @@
import org.forgerock.i18n.LocalizableMessage;
import org.forgerock.i18n.LocalizableMessageBuilder;
import org.forgerock.opendj.ldap.ByteString;
+import org.forgerock.opendj.ldap.schema.AttributeType;
import org.opends.guitools.controlpanel.datamodel.BinaryValue;
import org.opends.guitools.controlpanel.datamodel.CheckEntrySyntaxException;
import org.opends.guitools.controlpanel.datamodel.CustomSearchResult;
@@ -92,7 +93,6 @@
import org.opends.guitools.controlpanel.ui.nodes.DndBrowserNodes;
import org.opends.guitools.controlpanel.util.Utilities;
import org.opends.server.schema.SchemaConstants;
-import org.forgerock.opendj.ldap.schema.AttributeType;
import org.opends.server.types.*;
import org.opends.server.util.Base64;
import org.opends.server.util.LDIFReader;
@@ -1176,48 +1176,35 @@
private boolean isSingleValue(String attrName)
{
- boolean isSingleValue = false;
-
Schema schema = getInfo().getServerDescriptor().getSchema();
- if (schema != null)
+ if (schema != null && schema.hasAttributeType(attrName))
{
- if (schema.hasAttributeType(attrName.toLowerCase()))
- {
- AttributeType attr = schema.getAttributeType(attrName.toLowerCase());
- isSingleValue = attr.isSingleValue();
- }
+ AttributeType attr = schema.getAttributeType(attrName);
+ return attr.isSingleValue();
}
-
- return isSingleValue;
+ return false;
}
private boolean isRequired(String attrName, CustomSearchResult sr)
{
- boolean isRequired = false;
-
attrName = Utilities.getAttributeNameWithoutOptions(attrName);
Schema schema = getInfo().getServerDescriptor().getSchema();
- if (schema != null)
+ if (schema != null && schema.hasAttributeType(attrName))
{
- if (schema.hasAttributeType(attrName.toLowerCase()))
+ AttributeType attr = schema.getAttributeType(attrName);
+ List<Object> ocs = sr.getAttributeValues(ServerConstants.OBJECTCLASS_ATTRIBUTE_TYPE_NAME);
+ for (Object o : ocs)
{
- AttributeType attr = schema.getAttributeType(attrName.toLowerCase());
- List<Object> ocs = sr.getAttributeValues(
- ServerConstants.OBJECTCLASS_ATTRIBUTE_TYPE_NAME);
- for (Object o : ocs)
+ String oc = (String) o;
+ ObjectClass objectClass = schema.getObjectClass(oc.toLowerCase());
+ if (objectClass != null && objectClass.isRequired(attr))
{
- String oc = (String)o;
- ObjectClass objectClass = schema.getObjectClass(oc.toLowerCase());
- if (objectClass != null && objectClass.isRequired(attr))
- {
- isRequired = true;
- break;
- }
+ return true;
}
}
}
- return isRequired;
+ return false;
}
/** {@inheritDoc} */
@@ -1438,30 +1425,27 @@
private boolean mustAddBrowseButton(String attrName)
{
- boolean mustAddBrowseButton =
- attrName.equalsIgnoreCase(ServerConstants.ATTR_UNIQUE_MEMBER_LC) ||
- attrName.equalsIgnoreCase("ds-target-group-dn");
- if (!mustAddBrowseButton)
+ if (attrName.equalsIgnoreCase(ServerConstants.ATTR_UNIQUE_MEMBER_LC)
+ || attrName.equalsIgnoreCase("ds-target-group-dn"))
{
- Schema schema = getInfo().getServerDescriptor().getSchema();
- if (schema != null)
+ return true;
+ }
+ Schema schema = getInfo().getServerDescriptor().getSchema();
+ if (schema != null && schema.hasAttributeType(attrName))
+ {
+ AttributeType attr = schema.getAttributeType(attrName);
+ // There is no name for a regex syntax.
+ String syntaxName = attr.getSyntax().getName();
+ if (syntaxName != null)
{
- if (schema.hasAttributeType(attrName.toLowerCase()))
- {
- AttributeType attr = schema.getAttributeType(attrName.toLowerCase());
- // There is no name for a regex syntax.
- String syntaxName = attr.getSyntax().getName();
- if (syntaxName!=null) {
- mustAddBrowseButton=syntaxName.equalsIgnoreCase(
- SchemaConstants.SYNTAX_DN_NAME);
- }
- }
+ return syntaxName.equalsIgnoreCase(SchemaConstants.SYNTAX_DN_NAME);
}
}
- return mustAddBrowseButton;
+ return false;
}
/** {@inheritDoc} */
+ @Override
protected List<Object> getValues(String attrName)
{
List<Object> values = new ArrayList<>();
@@ -1518,8 +1502,7 @@
String firstNonEmpty = getFirstNonEmpty(values);
if (firstNonEmpty != null)
{
- AttributeType attr = rdn.getAttributeType(i);
- attributeTypes.add(attr);
+ attributeTypes.add(rdn.getAttributeType(i));
attributeNames.add(rdn.getAttributeName(i));
attributeValues.add(ByteString.valueOfUtf8(firstNonEmpty));
}
@@ -1552,12 +1535,10 @@
Object o = comps.iterator().next().getValue();
if (o instanceof String)
{
- String aName =
- Utilities.getAttributeNameWithoutOptions(attrName);
- if (schema.hasAttributeType(aName.toLowerCase()))
+ String aName = Utilities.getAttributeNameWithoutOptions(attrName);
+ if (schema.hasAttributeType(aName))
{
- AttributeType attr = schema.getAttributeType(aName.toLowerCase());
- attributeTypes.add(attr);
+ attributeTypes.add(schema.getAttributeType(aName));
attributeNames.add(attrName);
attributeValues.add(ByteString.valueOfUtf8((String) o));
}
diff --git a/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/TableViewEntryPanel.java b/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/TableViewEntryPanel.java
index 4da6172..50040a7 100644
--- a/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/TableViewEntryPanel.java
+++ b/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/TableViewEntryPanel.java
@@ -300,8 +300,7 @@
String firstNonEmpty = getFirstNonEmpty(values);
if (firstNonEmpty != null)
{
- AttributeType attr = rdn.getAttributeType(i);
- attributeTypes.add(attr);
+ attributeTypes.add(rdn.getAttributeType(i));
attributeNames.add(rdn.getAttributeName(i));
attributeValues.add(ByteString.valueOfUtf8(firstNonEmpty));
}
@@ -334,12 +333,10 @@
Object o = table.getValueAt(i, 1);
if (o instanceof String)
{
- String aName =
- Utilities.getAttributeNameWithoutOptions(attrName);
- if (schema.hasAttributeType(aName.toLowerCase()))
+ String aName = Utilities.getAttributeNameWithoutOptions(attrName);
+ if (schema.hasAttributeType(aName))
{
- AttributeType attr = schema.getAttributeType(aName.toLowerCase());
- attributeTypes.add(attr);
+ attributeTypes.add(schema.getAttributeType(aName));
attributeNames.add(attrName);
attributeValues.add(ByteString.valueOfUtf8((String) o));
}
diff --git a/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/ViewEntryPanel.java b/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/ViewEntryPanel.java
index dcd9877..0ca1db6 100644
--- a/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/ViewEntryPanel.java
+++ b/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/ViewEntryPanel.java
@@ -570,17 +570,13 @@
*/
public static boolean isEditable(String attrName, Schema schema)
{
- boolean isEditable = false;
attrName = Utilities.getAttributeNameWithoutOptions(attrName);
- if (schema != null)
+ if (schema != null && schema.hasAttributeType(attrName))
{
- if (schema.hasAttributeType(attrName.toLowerCase()))
- {
- AttributeType attrType = schema.getAttributeType(attrName.toLowerCase());
- isEditable = !attrType.isNoUserModification();
- }
+ AttributeType attrType = schema.getAttributeType(attrName);
+ return !attrType.isNoUserModification();
}
- return isEditable;
+ return false;
}
/**
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/admin/AttributeTypePropertyDefinition.java b/opendj-server-legacy/src/main/java/org/opends/server/admin/AttributeTypePropertyDefinition.java
index c6fe899..73ba94b 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/admin/AttributeTypePropertyDefinition.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/admin/AttributeTypePropertyDefinition.java
@@ -30,8 +30,8 @@
import java.util.EnumSet;
-import org.opends.server.core.DirectoryServer;
import org.forgerock.opendj.ldap.schema.AttributeType;
+import org.opends.server.core.DirectoryServer;
/** Attribute type property definition. */
public final class AttributeTypePropertyDefinition extends
@@ -156,13 +156,11 @@
- /** {@inheritDoc} */
@Override
- public AttributeType decodeValue(String value)
- throws PropertyException {
+ public AttributeType decodeValue(String value) throws PropertyException {
ifNull(value);
- String name = value.trim().toLowerCase();
+ String name = value.trim();
AttributeType type = isCheckSchema
? DirectoryServer.getAttributeTypeOrNull(name)
: DirectoryServer.getAttributeTypeOrDefault(name);
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/authorization/dseecompat/AciEffectiveRights.java b/opendj-server-legacy/src/main/java/org/opends/server/authorization/dseecompat/AciEffectiveRights.java
index c74273b..dae178e 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/authorization/dseecompat/AciEffectiveRights.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/authorization/dseecompat/AciEffectiveRights.java
@@ -232,11 +232,11 @@
{
if (aclRights == null)
{
- aclRights = DirectoryServer.getAttributeTypeOrNull(aclRightsAttrStr.toLowerCase());
+ aclRights = DirectoryServer.getAttributeTypeOrNull(aclRightsAttrStr);
}
if (aclRightsInfo == null)
{
- aclRightsInfo = DirectoryServer.getAttributeTypeOrNull(aclRightsInfoAttrStr.toLowerCase());
+ aclRightsInfo = DirectoryServer.getAttributeTypeOrNull(aclRightsInfoAttrStr);
}
if (dnAttributeType == null)
{
@@ -274,7 +274,7 @@
}
else
{
- nonRightsAttrs.add(DirectoryServer.getAttributeTypeOrDefault(a.toLowerCase()));
+ nonRightsAttrs.add(DirectoryServer.getAttributeTypeOrDefault(a));
}
}
}
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/authorization/dseecompat/PatternRDN.java b/opendj-server-legacy/src/main/java/org/opends/server/authorization/dseecompat/PatternRDN.java
index 76e04c2..190abeb 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/authorization/dseecompat/PatternRDN.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/authorization/dseecompat/PatternRDN.java
@@ -40,10 +40,13 @@
import org.forgerock.opendj.ldap.ByteString;
import org.forgerock.opendj.ldap.DecodeException;
import org.forgerock.opendj.ldap.ResultCode;
+import org.forgerock.opendj.ldap.schema.AttributeType;
import org.forgerock.opendj.ldap.schema.MatchingRule;
import org.opends.server.core.DirectoryServer;
-import org.forgerock.opendj.ldap.schema.AttributeType;
-import org.opends.server.types.*;
+import org.opends.server.types.Attribute;
+import org.opends.server.types.Attributes;
+import org.opends.server.types.DirectoryException;
+import org.opends.server.types.RDN;
/**
* This class is used to match RDN patterns containing wildcards in either
@@ -173,7 +176,7 @@
AttributeType thatType = rdn.getAttributeType(0);
if (!typePatterns[0].equals("*"))
{
- AttributeType thisType = DirectoryServer.getAttributeTypeOrNull(typePatterns[0].toLowerCase());
+ AttributeType thisType = DirectoryServer.getAttributeTypeOrNull(typePatterns[0]);
if (thisType == null || !thisType.equals(thatType))
{
return false;
@@ -205,8 +208,7 @@
for (int i = 0; i < numValues; i++)
{
- String lowerName = typePatterns[i].toLowerCase();
- AttributeType type = DirectoryServer.getAttributeTypeOrNull(lowerName);
+ AttributeType type = DirectoryServer.getAttributeTypeOrNull(typePatterns[i]);
if (type == null)
{
return false;
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/backends/pluggable/EntryContainer.java b/opendj-server-legacy/src/main/java/org/opends/server/backends/pluggable/EntryContainer.java
index 85eae55..02d4e70 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/backends/pluggable/EntryContainer.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/backends/pluggable/EntryContainer.java
@@ -60,6 +60,7 @@
import org.forgerock.opendj.ldap.ByteStringBuilder;
import org.forgerock.opendj.ldap.ResultCode;
import org.forgerock.opendj.ldap.SearchScope;
+import org.forgerock.opendj.ldap.schema.AttributeType;
import org.forgerock.util.Pair;
import org.opends.messages.CoreMessages;
import org.opends.server.admin.server.ConfigurationAddListener;
@@ -97,7 +98,6 @@
import org.opends.server.core.SearchOperation;
import org.opends.server.protocols.ldap.LDAPResultCode;
import org.opends.server.types.Attribute;
-import org.forgerock.opendj.ldap.schema.AttributeType;
import org.opends.server.types.Attributes;
import org.opends.server.types.CanceledOperationException;
import org.opends.server.types.Control;
@@ -309,7 +309,7 @@
return false;
}
- AttributeType attrType = DirectoryServer.getAttributeTypeOrNull(sortAttrs[i].toLowerCase());
+ AttributeType attrType = DirectoryServer.getAttributeTypeOrNull(sortAttrs[i]);
if(attrType == null)
{
unacceptableReasons.add(ERR_CONFIG_VLV_INDEX_UNDEFINED_ATTR.get(sortAttrs[i], cfg.getName()));
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/backends/pluggable/VLVIndex.java b/opendj-server-legacy/src/main/java/org/opends/server/backends/pluggable/VLVIndex.java
index 10000cc..94207fe 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/backends/pluggable/VLVIndex.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/backends/pluggable/VLVIndex.java
@@ -48,6 +48,7 @@
import org.forgerock.opendj.ldap.DecodeException;
import org.forgerock.opendj.ldap.ResultCode;
import org.forgerock.opendj.ldap.SearchScope;
+import org.forgerock.opendj.ldap.schema.AttributeType;
import org.forgerock.opendj.ldap.schema.MatchingRule;
import org.forgerock.util.Reject;
import org.opends.server.admin.server.ConfigurationChangeListener;
@@ -69,7 +70,6 @@
import org.opends.server.core.SearchOperation;
import org.opends.server.protocols.ldap.LDAPResultCode;
import org.opends.server.types.Attribute;
-import org.forgerock.opendj.ldap.schema.AttributeType;
import org.opends.server.types.DN;
import org.opends.server.types.DirectoryException;
import org.opends.server.types.Entry;
@@ -327,7 +327,7 @@
throw new ConfigException(ERR_CONFIG_VLV_INDEX_UNDEFINED_ATTR.get(sortKeys[i], getName()));
}
- final AttributeType attrType = DirectoryServer.getAttributeTypeOrNull(sortAttrs[i].toLowerCase());
+ final AttributeType attrType = DirectoryServer.getAttributeTypeOrNull(sortAttrs[i]);
if (attrType == null)
{
throw new ConfigException(ERR_CONFIG_VLV_INDEX_UNDEFINED_ATTR.get(sortAttrs[i], getName()));
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/backends/task/RecurringTask.java b/opendj-server-legacy/src/main/java/org/opends/server/backends/task/RecurringTask.java
index 614b5c7..3f00c34 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/backends/task/RecurringTask.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/backends/task/RecurringTask.java
@@ -40,10 +40,10 @@
import org.forgerock.i18n.slf4j.LocalizedLogger;
import org.forgerock.opendj.ldap.ByteString;
import org.forgerock.opendj.ldap.ResultCode;
+import org.forgerock.opendj.ldap.schema.AttributeType;
import org.opends.server.core.DirectoryServer;
import org.opends.server.core.ServerContext;
import org.opends.server.types.Attribute;
-import org.forgerock.opendj.ldap.schema.AttributeType;
import org.opends.server.types.Attributes;
import org.opends.server.types.DN;
import org.opends.server.types.DirectoryException;
@@ -349,18 +349,15 @@
SimpleDateFormat df = new SimpleDateFormat("yyyyMMddHHmmssSSS");
String nextTaskID = task.getTaskID() + "-" + df.format(nextTaskDate);
String nextTaskIDName = NAME_PREFIX_TASK + "id";
- AttributeType taskIDAttrType = DirectoryServer.getAttributeTypeOrNull(nextTaskIDName);
- Attribute nextTaskIDAttr = Attributes.create(taskIDAttrType, nextTaskID);
- nextTaskEntry.replaceAttribute(nextTaskIDAttr);
+ nextTaskEntry.replaceAttribute(Attributes.create(nextTaskIDName, nextTaskID));
+
RDN nextTaskRDN = RDN.decode(nextTaskIDName + "=" + nextTaskID);
DN nextTaskDN = new DN(nextTaskRDN,
taskScheduler.getTaskBackend().getScheduledTasksParentDN());
nextTaskEntry.setDN(nextTaskDN);
String nextTaskStartTimeName = NAME_PREFIX_TASK + "scheduled-start-time";
- AttributeType taskStartTimeAttrType = DirectoryServer.getAttributeTypeOrNull(nextTaskStartTimeName);
- Attribute nextTaskStartTimeAttr = Attributes.create(taskStartTimeAttrType, nextTaskStartTime);
- nextTaskEntry.replaceAttribute(nextTaskStartTimeAttr);
+ nextTaskEntry.replaceAttribute(Attributes.create(nextTaskStartTimeName, nextTaskStartTime));
nextTask.initializeTaskInternal(serverContext, taskScheduler, nextTaskEntry);
nextTask.initializeTask();
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/controls/ServerSideSortRequestControl.java b/opendj-server-legacy/src/main/java/org/opends/server/controls/ServerSideSortRequestControl.java
index 8dfe6ee..8a87356 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/controls/ServerSideSortRequestControl.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/controls/ServerSideSortRequestControl.java
@@ -26,20 +26,21 @@
*/
package org.opends.server.controls;
-import org.forgerock.i18n.LocalizableMessage;
-
+import java.io.IOException;
import java.util.ArrayList;
import java.util.StringTokenizer;
-import java.io.IOException;
+import org.forgerock.i18n.LocalizableMessage;
+import org.forgerock.opendj.io.ASN1;
+import org.forgerock.opendj.io.ASN1Reader;
+import org.forgerock.opendj.io.ASN1Writer;
+import org.forgerock.opendj.ldap.ByteString;
+import org.forgerock.opendj.ldap.ResultCode;
+import org.forgerock.opendj.ldap.schema.AttributeType;
import org.forgerock.opendj.ldap.schema.MatchingRule;
import org.opends.server.core.DirectoryServer;
-import org.forgerock.opendj.io.*;
import org.opends.server.protocols.ldap.LDAPResultCode;
-import org.forgerock.opendj.ldap.schema.AttributeType;
import org.opends.server.types.*;
-import org.forgerock.opendj.ldap.ResultCode;
-import org.forgerock.opendj.ldap.ByteString;
import static org.opends.messages.ProtocolMessages.*;
import static org.opends.server.util.ServerConstants.*;
@@ -107,7 +108,7 @@
while(reader.hasNextElement())
{
reader.readStartSequence();
- String attrName = toLowerCase(reader.readOctetStringAsString());
+ String attrName = reader.readOctetStringAsString();
AttributeType attrType = DirectoryServer.getAttributeTypeOrNull(attrName);
if (attrType == null)
{
@@ -440,7 +441,7 @@
ArrayList<SortKey> sortKeys = new ArrayList<>();
for(String[] decodedKey : decodedKeyList)
{
- AttributeType attrType = DirectoryServer.getAttributeTypeOrNull(decodedKey[0].toLowerCase());
+ AttributeType attrType = DirectoryServer.getAttributeTypeOrNull(decodedKey[0]);
if (attrType == null)
{
//This attribute is not defined in the schema. There is no point
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/core/DirectoryServer.java b/opendj-server-legacy/src/main/java/org/opends/server/core/DirectoryServer.java
index 9b96b2b..ea9520a 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/core/DirectoryServer.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/core/DirectoryServer.java
@@ -2515,15 +2515,13 @@
/**
* Retrieves the attribute type for the provided lowercase name or OID.
*
- * @param lowerName The lowercase attribute name or OID for the attribute
- * type to retrieve.
- *
+ * @param attrName The attribute name or OID for the attribute type to retrieve.
* @return The requested attribute type, or <CODE>null</CODE> if there is no
* attribute with the specified type defined in the server schema.
*/
- public static AttributeType getAttributeTypeOrNull(String lowerName)
+ public static AttributeType getAttributeTypeOrNull(String attrName)
{
- AttributeType attrType = directoryServer.schema.getAttributeType(lowerName);
+ AttributeType attrType = directoryServer.schema.getAttributeType(attrName);
return attrType.isPlaceHolder() ? null : attrType;
}
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/core/SubentryPasswordPolicy.java b/opendj-server-legacy/src/main/java/org/opends/server/core/SubentryPasswordPolicy.java
index 5eee633..7d4e677 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/core/SubentryPasswordPolicy.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/core/SubentryPasswordPolicy.java
@@ -174,7 +174,7 @@
String value = getAttrValue(entry, PWD_ATTR_ATTRIBUTE);
if (value != null && value.length() > 0)
{
- this.pPasswordAttribute = DirectoryServer.getAttributeTypeOrNull(value.toLowerCase());
+ this.pPasswordAttribute = DirectoryServer.getAttributeTypeOrNull(value);
if (this.pPasswordAttribute == null)
{
throw new DirectoryException(ResultCode.UNWILLING_TO_PERFORM,
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/plugins/AttributeCleanupPlugin.java b/opendj-server-legacy/src/main/java/org/opends/server/plugins/AttributeCleanupPlugin.java
index 621e954..81ef5b7 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/plugins/AttributeCleanupPlugin.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/plugins/AttributeCleanupPlugin.java
@@ -22,7 +22,7 @@
*
*
* Copyright 2011 profiq s.r.o.
- * Portions Copyright 2011-2015 ForgeRock AS.
+ * Portions Copyright 2011-2016 ForgeRock AS.
*/
package org.opends.server.plugins;
@@ -306,7 +306,7 @@
? toAttr
: toAttr.substring(semicolonPos + 1);
- if (DirectoryServer.getAttributeTypeOrNull(toLowerCase(toAttrType)) == null)
+ if (DirectoryServer.getAttributeTypeOrNull(toAttrType) == null)
{
messages.add(ERR_PLUGIN_ATTR_CLEANUP_ATTRIBUTE_MISSING.get(toAttr));
isValid = false;
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/plugins/ReferentialIntegrityPlugin.java b/opendj-server-legacy/src/main/java/org/opends/server/plugins/ReferentialIntegrityPlugin.java
index cd71959..600b031 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/plugins/ReferentialIntegrityPlugin.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/plugins/ReferentialIntegrityPlugin.java
@@ -56,6 +56,7 @@
import org.forgerock.opendj.ldap.ModificationType;
import org.forgerock.opendj.ldap.ResultCode;
import org.forgerock.opendj.ldap.SearchScope;
+import org.forgerock.opendj.ldap.schema.AttributeType;
import org.opends.server.admin.server.ConfigurationChangeListener;
import org.opends.server.admin.std.meta.PluginCfgDefn;
import org.opends.server.admin.std.meta.ReferentialIntegrityPluginCfgDefn.CheckReferencesScopeCriteria;
@@ -73,7 +74,6 @@
import org.opends.server.protocols.internal.InternalClientConnection;
import org.opends.server.protocols.internal.InternalSearchOperation;
import org.opends.server.protocols.internal.SearchRequest;
-import org.forgerock.opendj.ldap.schema.AttributeType;
import org.opends.server.types.*;
import org.opends.server.types.operation.PostOperationDeleteOperation;
import org.opends.server.types.operation.PostOperationModifyDNOperation;
@@ -223,7 +223,7 @@
String attr = attrFilt.substring(0, sepInd);
String filtStr = attrFilt.substring(sepInd + 1);
- AttributeType attrType = DirectoryServer.getAttributeTypeOrNull(attr.toLowerCase());
+ AttributeType attrType = DirectoryServer.getAttributeTypeOrNull(attr);
try
{
SearchFilter filter = SearchFilter.createFilterFromString(filtStr);
@@ -346,7 +346,7 @@
* type has to be present in the attributeType list.
*/
- AttributeType attrType = DirectoryServer.getAttributeTypeOrNull(attr.toLowerCase());
+ AttributeType attrType = DirectoryServer.getAttributeTypeOrNull(attr);
if (attrType == null || !theAttributeTypes.contains(attrType))
{
isAcceptable = false;
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/types/Entry.java b/opendj-server-legacy/src/main/java/org/opends/server/types/Entry.java
index ff8c9cc..b054d5e 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/types/Entry.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/types/Entry.java
@@ -26,8 +26,6 @@
*/
package org.opends.server.types;
-import org.forgerock.opendj.ldap.schema.AttributeType;
-
import java.io.BufferedWriter;
import java.io.IOException;
import java.util.*;
@@ -43,6 +41,7 @@
import org.forgerock.opendj.ldap.DecodeException;
import org.forgerock.opendj.ldap.ResultCode;
import org.forgerock.opendj.ldap.SearchScope;
+import org.forgerock.opendj.ldap.schema.AttributeType;
import org.forgerock.opendj.ldap.schema.MatchingRule;
import org.forgerock.opendj.ldap.schema.ObjectClassType;
import org.opends.server.api.CompressedSchema;
@@ -4501,13 +4500,13 @@
continue;
}
- String lowerName;
+ String name;
Set<String> options;
int semicolonPos = attrName.indexOf(';');
if (semicolonPos > 0)
{
String tmpName = attrName.substring(0, semicolonPos);
- lowerName = toLowerCase(tmpName);
+ name = tmpName;
int nextPos = attrName.indexOf(';', semicolonPos+1);
options = new HashSet<>();
while (nextPos > 0)
@@ -4522,11 +4521,11 @@
}
else
{
- lowerName = toLowerCase(attrName);
+ name = attrName;
options = null;
}
- AttributeType attrType = DirectoryServer.getAttributeTypeOrNull(lowerName);
+ AttributeType attrType = DirectoryServer.getAttributeTypeOrNull(name);
if (attrType == null)
{
// Unrecognized attribute type - do best effort search.
@@ -4534,7 +4533,7 @@
userAttributes.entrySet())
{
AttributeType t = e.getKey();
- if (t.hasNameOrOID(lowerName))
+ if (t.hasNameOrOID(name))
{
mergeAttributeLists(e.getValue(), userAttrsCopy, t,
attrName, options, omitValues, omitReal, omitVirtual);
@@ -4546,7 +4545,7 @@
operationalAttributes.entrySet())
{
AttributeType t = e.getKey();
- if (t.hasNameOrOID(lowerName))
+ if (t.hasNameOrOID(name))
{
mergeAttributeLists(e.getValue(), operationalAttrsCopy,
t, attrName, options, omitValues, omitReal, omitVirtual);
diff --git a/opendj-server-legacy/src/test/java/org/opends/server/admin/ValidateConfigDefinitionsTest.java b/opendj-server-legacy/src/test/java/org/opends/server/admin/ValidateConfigDefinitionsTest.java
index e2fcfe5..d481bc2 100644
--- a/opendj-server-legacy/src/test/java/org/opends/server/admin/ValidateConfigDefinitionsTest.java
+++ b/opendj-server-legacy/src/test/java/org/opends/server/admin/ValidateConfigDefinitionsTest.java
@@ -190,12 +190,12 @@
Schema schema = DirectoryServer.getSchema();
// LDAP attribute exists
- if (!schema.hasAttributeType(ldapAttrName.toLowerCase()))
+ if (!schema.hasAttributeType(ldapAttrName))
{
errors.append(propName + " property on config object " + objName + " is declared" +
" to use ldap attribute " + ldapAttrName + ", but this attribute is not in the schema ").append(EOL + EOL);
} else {
- AttributeType attrType = schema.getAttributeType(ldapAttrName.toLowerCase());
+ AttributeType attrType = schema.getAttributeType(ldapAttrName);
// LDAP attribute is multivalued if the property is multivalued
if (propDef.hasOption(PropertyOption.MULTI_VALUED) && attrType.isSingleValue()) {
diff --git a/opendj-server-legacy/src/test/java/org/opends/server/backends/pluggable/PluggableBackendImplTestCase.java b/opendj-server-legacy/src/test/java/org/opends/server/backends/pluggable/PluggableBackendImplTestCase.java
index 2ac8bc0..3ea04f6 100644
--- a/opendj-server-legacy/src/test/java/org/opends/server/backends/pluggable/PluggableBackendImplTestCase.java
+++ b/opendj-server-legacy/src/test/java/org/opends/server/backends/pluggable/PluggableBackendImplTestCase.java
@@ -167,7 +167,7 @@
for (Map.Entry<String, IndexType[]> index : backendIndexes.entrySet())
{
- final String attributeName = index.getKey().toLowerCase();
+ final String attributeName = index.getKey();
final AttributeType attribute = DirectoryServer.getAttributeTypeOrNull(attributeName);
Reject.ifNull(attribute, "Attribute type '" + attributeName + "' doesn't exists.");
@@ -626,7 +626,7 @@
{
for (IndexType type : index.getValue())
{
- final AttributeType attributeType = DirectoryServer.getAttributeTypeOrNull(index.getKey().toLowerCase());
+ final AttributeType attributeType = DirectoryServer.getAttributeTypeOrNull(index.getKey());
assertTrue(backend.isIndexed(attributeType,
org.opends.server.types.IndexType.valueOf(type.toString().toUpperCase())));
}
diff --git a/opendj-server-legacy/src/test/java/org/opends/server/core/SubentryManagerTestCase.java b/opendj-server-legacy/src/test/java/org/opends/server/core/SubentryManagerTestCase.java
index 99860b7..7f9330f 100644
--- a/opendj-server-legacy/src/test/java/org/opends/server/core/SubentryManagerTestCase.java
+++ b/opendj-server-legacy/src/test/java/org/opends/server/core/SubentryManagerTestCase.java
@@ -328,10 +328,10 @@
}
}
- private void hasValues(DN dn, String attrTypeLower, String... values) throws DirectoryException
+ private void hasValues(DN dn, String attrName, String... values) throws DirectoryException
{
Entry entry = DirectoryServer.getEntry(dn);
- AttributeType attrType = DirectoryServer.getAttributeTypeOrNull(attrTypeLower);
+ AttributeType attrType = DirectoryServer.getAttributeTypeOrNull(attrName);
assertTrue(entry.hasAttribute(attrType));
for (String value : values)
{
@@ -339,10 +339,10 @@
}
}
- private void doesNotHaveValues(DN dn, String attrTypeLower, String... values) throws DirectoryException
+ private void doesNotHaveValues(DN dn, String attrName, String... values) throws DirectoryException
{
Entry entry = DirectoryServer.getEntry(dn);
- AttributeType attrType = DirectoryServer.getAttributeTypeOrNull(attrTypeLower);
+ AttributeType attrType = DirectoryServer.getAttributeTypeOrNull(attrName);
assertTrue(entry.hasAttribute(attrType));
for (String value : values)
{
@@ -350,10 +350,10 @@
}
}
- private void hasNoAttribute(DN dn, String lowerName) throws Exception
+ private void hasNoAttribute(DN dn, String attrName) throws Exception
{
Entry entry = DirectoryServer.getEntry(dn);
- AttributeType attrType = DirectoryServer.getAttributeTypeOrNull(lowerName);
+ AttributeType attrType = DirectoryServer.getAttributeTypeOrNull(attrName);
assertFalse(entry.hasAttribute(attrType));
}
diff --git a/opendj-server-legacy/src/test/java/org/opends/server/replication/plugin/FractionalReplicationTest.java b/opendj-server-legacy/src/test/java/org/opends/server/replication/plugin/FractionalReplicationTest.java
index 222c5ca..c6932e8 100644
--- a/opendj-server-legacy/src/test/java/org/opends/server/replication/plugin/FractionalReplicationTest.java
+++ b/opendj-server-legacy/src/test/java/org/opends/server/replication/plugin/FractionalReplicationTest.java
@@ -680,14 +680,12 @@
switch (fractionalMode)
{
case EXCLUDE_FRAC_MODE:
- // Exclude mode: attributes should not be there, but OPTIONAL_ATTR
- // attribute should
+ // Exclude mode: attributes should not be there, but OPTIONAL_ATTR attribute should
for (String fracAttr : fractionalConf)
{
if (!first)
{
- assertFalse(newEntry.hasAttribute(DirectoryServer.
- getAttributeTypeOrNull(fracAttr.toLowerCase())));
+ assertFalse(newEntry.hasAttribute(DirectoryServer.getAttributeTypeOrNull(fracAttr)));
}
first = false;
}
@@ -704,8 +702,7 @@
}
first = false;
}
- assertFalse(newEntry.hasAttribute(DirectoryServer.
- getAttributeTypeOrNull(OPTIONAL_ATTR.toLowerCase())));
+ assertFalse(newEntry.hasAttribute(DirectoryServer.getAttributeTypeOrNull(OPTIONAL_ATTR)));
break;
default:
fail("Unexpected fractional mode.");
@@ -731,7 +728,7 @@
assertTrue(entry.hasObjectClass(objectClass));
}
- // Go through each interesting attribute and check it has been modifed or
+ // Go through each interesting attribute and check it has been modified or
// not according to the fractional mode
boolean first = true;
switch (fractionalMode)
@@ -743,8 +740,7 @@
{
if (!first)
{
- assertFalse(entry.hasAttribute(DirectoryServer.
- getAttributeTypeOrNull(fracAttr.toLowerCase())));
+ assertFalse(entry.hasAttribute(DirectoryServer.getAttributeTypeOrNull(fracAttr)));
}
first = false;
}
@@ -761,8 +757,7 @@
}
first = false;
}
- assertFalse(entry.hasAttribute(DirectoryServer.
- getAttributeTypeOrNull(OPTIONAL_ATTR.toLowerCase())));
+ assertFalse(entry.hasAttribute(DirectoryServer.getAttributeTypeOrNull(OPTIONAL_ATTR)));
break;
default:
fail("Unexpected fractional mode.");
@@ -981,7 +976,7 @@
private Entry waitTillEntryHasSynchroAttribute(String entryDN)
throws Exception
{
- AttributeType synchroAttrType = DirectoryServer.getAttributeTypeOrNull(SYNCHRO_OPTIONAL_ATTR.toLowerCase());
+ AttributeType synchroAttrType = DirectoryServer.getAttributeTypeOrNull(SYNCHRO_OPTIONAL_ATTR);
DN dn = DN.valueOf(entryDN);
Entry entry = null;
diff --git a/opendj-server-legacy/src/test/java/org/opends/server/replication/plugin/ModifyConflictTest.java b/opendj-server-legacy/src/test/java/org/opends/server/replication/plugin/ModifyConflictTest.java
index af5640d..a512d5d 100644
--- a/opendj-server-legacy/src/test/java/org/opends/server/replication/plugin/ModifyConflictTest.java
+++ b/opendj-server-legacy/src/test/java/org/opends/server/replication/plugin/ModifyConflictTest.java
@@ -55,7 +55,6 @@
import static org.opends.server.replication.plugin.EntryHistorical.*;
import static org.opends.server.replication.protocol.OperationContext.*;
import static org.opends.server.util.CollectionUtils.*;
-import static org.opends.server.util.StaticUtils.*;
import static org.testng.Assert.*;
/**
@@ -1198,7 +1197,7 @@
private void assertContainsOnlyValues(Entry entry, String attrName, String... expectedValues)
{
- Attribute attr = entry.getExactAttribute(getAttributeTypeOrNull(toLowerCase(attrName)), Collections.<String> emptySet());
+ Attribute attr = entry.getExactAttribute(getAttributeTypeOrNull(attrName), Collections.<String> emptySet());
assertThat(attr).hasSize(expectedValues.length);
for (String value : expectedValues)
{
--
Gitblit v1.10.0