From d3f7287f96515499730a23f82871b706b234cf96 Mon Sep 17 00:00:00 2001
From: Jean-Noël Rouvignac <jean-noel.rouvignac@forgerock.com>
Date: Fri, 29 Jan 2016 15:01:22 +0000
Subject: [PATCH] DirectoryServer.java: Removed getAttributeTypeOrDefault(String lowerName, String upperName), replaced by getAttributeTypeOrDefault(String lowerName)
---
opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/datamodel/CustomSearchResult.java | 5
opendj-server-legacy/src/main/java/org/opends/server/config/JMXMBean.java | 4
opendj-server-legacy/src/main/java/org/opends/server/core/DirectoryServer.java | 17 ----
opendj-server-legacy/src/main/java/org/opends/server/tools/ImportLDIF.java | 4
opendj-server-legacy/src/main/java/org/opends/server/backends/RootDSEBackend.java | 35 +++-----
opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/ManageTasksPanel.java | 5
opendj-server-legacy/src/main/java/org/opends/server/tasks/ImportTask.java | 2
opendj-server-legacy/src/main/java/org/opends/server/protocols/ldap/LDAPFilter.java | 4
opendj-server-legacy/src/main/java/org/opends/server/backends/ChangelogBackend.java | 10 +-
opendj-server-legacy/src/main/java/org/opends/server/types/RDN.java | 9 -
opendj-server-legacy/src/main/java/org/opends/server/tools/ExportLDIF.java | 2
opendj-server-legacy/src/main/java/org/opends/server/backends/task/TaskScheduler.java | 2
opendj-server-legacy/src/main/java/org/opends/server/types/Attributes.java | 8 -
opendj-server-legacy/src/main/java/org/opends/server/util/LDIFReader.java | 8 -
opendj-server-legacy/src/main/java/org/opends/server/tasks/ExportTask.java | 2
opendj-server-legacy/src/main/java/org/opends/server/core/PasswordPolicyState.java | 33 ++-----
opendj-server-legacy/src/main/java/org/opends/server/types/AttributeBuilder.java | 2
opendj-server-legacy/src/main/java/org/opends/server/types/DN.java | 33 ++------
opendj-server-legacy/src/main/java/org/opends/server/config/ConfigEntry.java | 3
opendj-server-legacy/src/main/java/org/opends/server/backends/task/Task.java | 3
opendj-server-legacy/src/main/java/org/opends/server/backends/task/RecurringTask.java | 2
opendj-server-legacy/src/main/java/org/opends/server/controls/MatchedValuesFilter.java | 3
22 files changed, 63 insertions(+), 133 deletions(-)
diff --git a/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/datamodel/CustomSearchResult.java b/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/datamodel/CustomSearchResult.java
index 5d9aa49..ac857dc 100644
--- a/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/datamodel/CustomSearchResult.java
+++ b/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/datamodel/CustomSearchResult.java
@@ -297,11 +297,10 @@
final org.opends.server.types.Attribute attribute =
LDIFReader.parseAttrDescription(wholeName);
final String attrName = attribute.getName();
- final String lowerName = toLowerCase(attrName);
// See if this is an objectclass or an attribute. Then get the
// corresponding definition and add the value to the appropriate hash.
- if (lowerName.equals("objectclass"))
+ if (attrName.equalsIgnoreCase("objectclass"))
{
for (Object value : getAttributeValues(attrName))
{
@@ -320,7 +319,7 @@
}
else
{
- AttributeType attrType = DirectoryServer.getAttributeTypeOrDefault(lowerName, attrName);
+ AttributeType attrType = DirectoryServer.getAttributeTypeOrDefault(attrName);
AttributeBuilder builder = new AttributeBuilder(attribute, true);
for (Object value : getAttributeValues(attrName))
{
diff --git a/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/ManageTasksPanel.java b/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/ManageTasksPanel.java
index 892c82d..6e65977 100644
--- a/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/ManageTasksPanel.java
+++ b/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/ManageTasksPanel.java
@@ -672,11 +672,10 @@
{
final Attribute attribute = parseAttrDescription(wholeName);
final String attrName = attribute.getName();
- final String lowerName = toLowerCase(attrName);
// See if this is an objectclass or an attribute. Then get the
// corresponding definition and add the value to the appropriate hash.
- if (lowerName.equals("objectclass"))
+ if (attrName.equalsIgnoreCase("objectclass"))
{
for (Object value : csr.getAttributeValues(attrName))
{
@@ -695,7 +694,7 @@
}
else
{
- AttributeType attrType = DirectoryServer.getAttributeTypeOrDefault(lowerName, attrName);
+ AttributeType attrType = DirectoryServer.getAttributeTypeOrDefault(attrName);
AttributeBuilder builder = new AttributeBuilder(attribute, true);
for (Object value : csr.getAttributeValues(attrName))
{
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/backends/ChangelogBackend.java b/opendj-server-legacy/src/main/java/org/opends/server/backends/ChangelogBackend.java
index 32c22f4..485c6ef 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/backends/ChangelogBackend.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/backends/ChangelogBackend.java
@@ -700,11 +700,11 @@
case 2:
// It is probably "changeNumber=xxx,cn=changelog", use equality filter
// But it also could be "<service-id>,cn=changelog" so need to check on attribute
- equalityFilter = buildSearchFilterFrom(baseDN, CHANGE_NUMBER_ATTR_LC, CHANGE_NUMBER_ATTR);
+ equalityFilter = buildSearchFilterFrom(baseDN, CHANGE_NUMBER_ATTR);
break;
default:
// "replicationCSN=xxx,<service-id>,cn=changelog" : use equality filter
- equalityFilter = buildSearchFilterFrom(baseDN, "replicationcsn", "replicationCSN");
+ equalityFilter = buildSearchFilterFrom(baseDN, "replicationCSN");
break;
}
@@ -717,10 +717,10 @@
* @return the search filter or {@code null} if attribute is not present in
* the provided DN
*/
- private SearchFilter buildSearchFilterFrom(final DN baseDN, final String lowerCaseAttr, final String upperCaseAttr)
+ private SearchFilter buildSearchFilterFrom(final DN baseDN, final String attrName)
{
final RDN rdn = baseDN.rdn();
- AttributeType attrType = DirectoryServer.getAttributeTypeOrDefault(lowerCaseAttr, upperCaseAttr);
+ AttributeType attrType = DirectoryServer.getAttributeTypeOrDefault(attrName);
final ByteString attrValue = rdn.getAttributeValue(attrType);
if (attrValue != null)
{
@@ -1502,7 +1502,7 @@
final Map<AttributeType, List<Attribute>> userAttrs,
final Map<AttributeType, List<Attribute>> operationalAttrs, final boolean addByType)
{
- AttributeType attrType = DirectoryServer.getAttributeTypeOrDefault(attrNameLowercase, attrNameUppercase);
+ AttributeType attrType = DirectoryServer.getAttributeTypeOrDefault(attrNameUppercase);
final Attribute a = addByType
? Attributes.create(attrType, attrValue)
: Attributes.create(attrNameUppercase, attrValue);
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/backends/RootDSEBackend.java b/opendj-server-legacy/src/main/java/org/opends/server/backends/RootDSEBackend.java
index 9806fe5..2fc9ad6 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/backends/RootDSEBackend.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/backends/RootDSEBackend.java
@@ -441,36 +441,32 @@
Map<AttributeType, List<Attribute>> dseOperationalAttrs = new HashMap<>();
Attribute publicNamingContextAttr = createAttribute(
- ATTR_NAMING_CONTEXTS, ATTR_NAMING_CONTEXTS_LC,
- DirectoryServer.getPublicNamingContexts().keySet());
+ ATTR_NAMING_CONTEXTS, DirectoryServer.getPublicNamingContexts().keySet());
addAttribute(publicNamingContextAttr, dseUserAttrs, dseOperationalAttrs);
// Add the "ds-private-naming-contexts" attribute.
Attribute privateNamingContextAttr = createAttribute(
- ATTR_PRIVATE_NAMING_CONTEXTS, ATTR_PRIVATE_NAMING_CONTEXTS,
- DirectoryServer.getPrivateNamingContexts().keySet());
+ ATTR_PRIVATE_NAMING_CONTEXTS, DirectoryServer.getPrivateNamingContexts().keySet());
addAttribute(privateNamingContextAttr, dseUserAttrs, dseOperationalAttrs);
// Add the "supportedControl" attribute.
Attribute supportedControlAttr = createAttribute(ATTR_SUPPORTED_CONTROL,
- ATTR_SUPPORTED_CONTROL_LC, DirectoryServer.getSupportedControls());
+ DirectoryServer.getSupportedControls());
addAttribute(supportedControlAttr, dseUserAttrs, dseOperationalAttrs);
// Add the "supportedExtension" attribute.
Attribute supportedExtensionAttr = createAttribute(
- ATTR_SUPPORTED_EXTENSION, ATTR_SUPPORTED_EXTENSION_LC, DirectoryServer
- .getSupportedExtensions().keySet());
+ ATTR_SUPPORTED_EXTENSION, DirectoryServer.getSupportedExtensions().keySet());
addAttribute(supportedExtensionAttr, dseUserAttrs, dseOperationalAttrs);
// Add the "supportedFeature" attribute.
Attribute supportedFeatureAttr = createAttribute(ATTR_SUPPORTED_FEATURE,
- ATTR_SUPPORTED_FEATURE_LC, DirectoryServer.getSupportedFeatures());
+ DirectoryServer.getSupportedFeatures());
addAttribute(supportedFeatureAttr, dseUserAttrs, dseOperationalAttrs);
// Add the "supportedSASLMechanisms" attribute.
Attribute supportedSASLMechAttr = createAttribute(
- ATTR_SUPPORTED_SASL_MECHANISMS, ATTR_SUPPORTED_SASL_MECHANISMS_LC,
- DirectoryServer.getSupportedSASLMechanisms().keySet());
+ ATTR_SUPPORTED_SASL_MECHANISMS, DirectoryServer.getSupportedSASLMechanisms().keySet());
addAttribute(supportedSASLMechAttr, dseUserAttrs, dseOperationalAttrs);
// Add the "supportedLDAPVersions" attribute.
@@ -480,13 +476,12 @@
versionStrings.add(ldapVersion.toString());
}
Attribute supportedLDAPVersionAttr = createAttribute(
- ATTR_SUPPORTED_LDAP_VERSION, ATTR_SUPPORTED_LDAP_VERSION_LC, versionStrings);
+ ATTR_SUPPORTED_LDAP_VERSION, versionStrings);
addAttribute(supportedLDAPVersionAttr, dseUserAttrs, dseOperationalAttrs);
// Add the "supportedAuthPasswordSchemes" attribute.
Attribute supportedAuthPWSchemesAttr = createAttribute(
- ATTR_SUPPORTED_AUTH_PW_SCHEMES, ATTR_SUPPORTED_AUTH_PW_SCHEMES_LC,
- DirectoryServer.getAuthPasswordStorageSchemes().keySet());
+ ATTR_SUPPORTED_AUTH_PW_SCHEMES, DirectoryServer.getAuthPasswordStorageSchemes().keySet());
addAttribute(supportedAuthPWSchemesAttr, dseUserAttrs, dseOperationalAttrs);
@@ -519,14 +514,12 @@
// Add the "supportedTLSProtocols" attribute.
Attribute supportedTLSProtocolsAttr = createAttribute(
- ATTR_SUPPORTED_TLS_PROTOCOLS, ATTR_SUPPORTED_TLS_PROTOCOLS_LC,
- supportedTlsProtocols);
+ ATTR_SUPPORTED_TLS_PROTOCOLS, supportedTlsProtocols);
addAttribute(supportedTLSProtocolsAttr, dseUserAttrs, dseOperationalAttrs);
// Add the "supportedTLSCiphers" attribute.
Attribute supportedTLSCiphersAttr = createAttribute(
- ATTR_SUPPORTED_TLS_CIPHERS, ATTR_SUPPORTED_TLS_CIPHERS_LC,
- supportedTlsCiphers);
+ ATTR_SUPPORTED_TLS_CIPHERS, supportedTlsCiphers);
addAttribute(supportedTLSCiphersAttr, dseUserAttrs, dseOperationalAttrs);
addAll(staticDSEAttributes, dseUserAttrs, dseOperationalAttrs);
@@ -584,17 +577,13 @@
*
* @param name
* The name for the attribute.
- * @param lowerName
- * The name for the attribute formatted in all lowercase
- * characters.
* @param values
* The set of values to use for the attribute.
* @return The constructed attribute.
*/
- private Attribute createAttribute(String name, String lowerName,
- Collection<? extends Object> values)
+ private Attribute createAttribute(String name, Collection<? extends Object> values)
{
- AttributeType type = DirectoryServer.getAttributeTypeOrDefault(lowerName, name);
+ AttributeType type = DirectoryServer.getAttributeTypeOrDefault(name);
AttributeBuilder builder = new AttributeBuilder(type, name);
builder.addAllStrings(values);
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 3f00c34..9d89b13 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
@@ -243,7 +243,7 @@
private Attribute getSingleAttribute(Entry taskEntry, String attrName, Arg1<Object> noEntryErrorMsg,
Arg1<Object> multipleEntriesErrorMsg, Arg1<Object> noAttrValueErrorMsg) throws DirectoryException
{
- AttributeType attrType = DirectoryServer.getAttributeTypeOrDefault(attrName.toLowerCase(), attrName);
+ AttributeType attrType = DirectoryServer.getAttributeTypeOrDefault(attrName);
List<Attribute> attrList = taskEntry.getAttribute(attrType);
if (attrList.isEmpty())
{
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/backends/task/Task.java b/opendj-server-legacy/src/main/java/org/opends/server/backends/task/Task.java
index 902d9be..ca78e72 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/backends/task/Task.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/backends/task/Task.java
@@ -844,8 +844,7 @@
String messageString = buffer.toString();
logMessages.add(messageString);
- AttributeType type = DirectoryServer.getAttributeTypeOrDefault(
- ATTR_TASK_LOG_MESSAGES.toLowerCase(), ATTR_TASK_LOG_MESSAGES);
+ AttributeType type = DirectoryServer.getAttributeTypeOrDefault(ATTR_TASK_LOG_MESSAGES);
final List<Attribute> attrList = taskEntry.getAttribute(type);
ByteString value = ByteString.valueOfUtf8(messageString);
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/backends/task/TaskScheduler.java b/opendj-server-legacy/src/main/java/org/opends/server/backends/task/TaskScheduler.java
index 7f4da56..641892d 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/backends/task/TaskScheduler.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/backends/task/TaskScheduler.java
@@ -1802,7 +1802,7 @@
throws DirectoryException
{
// Get the name of the class that implements the task logic.
- AttributeType attrType = DirectoryServer.getAttributeTypeOrDefault(ATTR_TASK_CLASS.toLowerCase(), ATTR_TASK_CLASS);
+ AttributeType attrType = DirectoryServer.getAttributeTypeOrDefault(ATTR_TASK_CLASS);
List<Attribute> attrList = entry.getAttribute(attrType);
if (attrList.isEmpty())
{
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/config/ConfigEntry.java b/opendj-server-legacy/src/main/java/org/opends/server/config/ConfigEntry.java
index 7fbaa9b..f4865a5 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/config/ConfigEntry.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/config/ConfigEntry.java
@@ -195,8 +195,7 @@
*/
public ConfigAttribute getConfigAttribute(ConfigAttribute stub) throws ConfigException
{
- String attrName = stub.getName();
- AttributeType attrType = DirectoryServer.getAttributeTypeOrDefault(attrName.toLowerCase(), attrName);
+ AttributeType attrType = DirectoryServer.getAttributeTypeOrDefault(stub.getName());
List<Attribute> attrList = entry.getAttribute(attrType);
return !attrList.isEmpty() ? stub.getConfigAttribute(attrList) : null;
}
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/config/JMXMBean.java b/opendj-server-legacy/src/main/java/org/opends/server/config/JMXMBean.java
index bebdeb3..d19373d 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/config/JMXMBean.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/config/JMXMBean.java
@@ -399,7 +399,7 @@
{
// It's possible that this is a monitor attribute rather than a configurable
// one. Check all of those.
- AttributeType attrType = DirectoryServer.getAttributeTypeOrDefault(name.toLowerCase(), name);
+ AttributeType attrType = DirectoryServer.getAttributeTypeOrDefault(name);
for (MonitorProvider<? extends MonitorProviderCfg> monitor : monitorProviders)
{
for (org.opends.server.types.Attribute a : monitor.getMonitorData())
@@ -581,7 +581,7 @@
// It's possible that this is a monitor attribute rather than a
// configurable one. Check all of those.
- AttributeType attrType = DirectoryServer.getAttributeTypeOrDefault(name.toLowerCase(), name);
+ AttributeType attrType = DirectoryServer.getAttributeTypeOrDefault(name);
monitorLoop:
for (MonitorProvider<? extends MonitorProviderCfg> monitor :
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/controls/MatchedValuesFilter.java b/opendj-server-legacy/src/main/java/org/opends/server/controls/MatchedValuesFilter.java
index 83f350d..12045b3 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/controls/MatchedValuesFilter.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/controls/MatchedValuesFilter.java
@@ -839,8 +839,7 @@
{
if (attributeType == null && rawAttributeType != null)
{
- String lowerName = toLowerCase(rawAttributeType);
- attributeType = DirectoryServer.getAttributeTypeOrDefault(lowerName, rawAttributeType);
+ attributeType = DirectoryServer.getAttributeTypeOrDefault(rawAttributeType);
}
return attributeType;
}
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 fd6dcdd..d0441c2 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
@@ -2542,23 +2542,6 @@
}
/**
- * Retrieves the attribute type for the provided lowercase name or OID. It will return a generated
- * "default" version with the uppercase name or OID if the requested attribute type is not defined
- * in the schema.
- *
- * @param lowerName
- * The lowercase name or OID for the attribute type to retrieve.
- * @param upperName
- * The uppercase name or OID for the attribute type to generate.
- * @return The requested attribute type, or a generated "default" version if there is no attribute
- * with the specified type defined in the server schema
- */
- public static AttributeType getAttributeTypeOrDefault(String lowerName, String upperName)
- {
- return getAttributeType(upperName, getDefaultAttributeSyntax());
- }
-
- /**
* Retrieves the attribute type for the provided name or OID. It will return a generated
* placeholder version with the name or OID if the requested attribute type is not defined in the
* schema.
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/core/PasswordPolicyState.java b/opendj-server-legacy/src/main/java/org/opends/server/core/PasswordPolicyState.java
index f64c53d..ba9fe9b 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/core/PasswordPolicyState.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/core/PasswordPolicyState.java
@@ -626,8 +626,7 @@
return authFailureTimes;
}
- AttributeType type = DirectoryServer.getAttributeTypeOrDefault(
- OP_ATTR_PWPOLICY_FAILURE_TIME_LC, OP_ATTR_PWPOLICY_FAILURE_TIME);
+ AttributeType type = DirectoryServer.getAttributeTypeOrDefault(OP_ATTR_PWPOLICY_FAILURE_TIME);
try
{
authFailureTimes = getGeneralizedTimes(type);
@@ -720,8 +719,7 @@
failureTimes.add(highestFailureTime);
// And the attribute in the user entry
- AttributeType type = DirectoryServer.getAttributeTypeOrDefault(
- OP_ATTR_PWPOLICY_FAILURE_TIME_LC, OP_ATTR_PWPOLICY_FAILURE_TIME);
+ AttributeType type = DirectoryServer.getAttributeTypeOrDefault(OP_ATTR_PWPOLICY_FAILURE_TIME);
Attribute addAttr = Attributes.create(type, GeneralizedTimeSyntax.format(highestFailureTime));
modifications.add(new Modification(ModificationType.ADD, addAttr, true));
@@ -801,8 +799,7 @@
failureTimes.clear(); // Note: failureTimes != this.authFailureTimes
- AttributeType type = DirectoryServer.getAttributeTypeOrDefault(
- OP_ATTR_PWPOLICY_FAILURE_TIME_LC, OP_ATTR_PWPOLICY_FAILURE_TIME);
+ AttributeType type = DirectoryServer.getAttributeTypeOrDefault(OP_ATTR_PWPOLICY_FAILURE_TIME);
modifications.add(new Modification(ModificationType.REPLACE, Attributes.empty(type), true));
}
@@ -819,8 +816,7 @@
return failureLockedTime;
}
- AttributeType type = DirectoryServer.getAttributeTypeOrDefault(
- OP_ATTR_PWPOLICY_LOCKED_TIME_LC, OP_ATTR_PWPOLICY_LOCKED_TIME);
+ AttributeType type = DirectoryServer.getAttributeTypeOrDefault(OP_ATTR_PWPOLICY_LOCKED_TIME);
try
{
failureLockedTime = getGeneralizedTime(userEntry, type);
@@ -853,8 +849,7 @@
failureLockedTime = time;
- AttributeType type = DirectoryServer.getAttributeTypeOrDefault(
- OP_ATTR_PWPOLICY_LOCKED_TIME_LC, OP_ATTR_PWPOLICY_LOCKED_TIME);
+ AttributeType type = DirectoryServer.getAttributeTypeOrDefault(OP_ATTR_PWPOLICY_LOCKED_TIME);
Attribute a = Attributes.create(type, GeneralizedTimeSyntax.format(failureLockedTime));
modifications.add(new Modification(ModificationType.REPLACE, a, true));
}
@@ -878,8 +873,7 @@
failureLockedTime = -1L;
- AttributeType type = DirectoryServer.getAttributeTypeOrDefault(
- OP_ATTR_PWPOLICY_LOCKED_TIME_LC, OP_ATTR_PWPOLICY_LOCKED_TIME);
+ AttributeType type = DirectoryServer.getAttributeTypeOrDefault(OP_ATTR_PWPOLICY_LOCKED_TIME);
modifications.add(new Modification(ModificationType.REPLACE, Attributes.empty(type), true));
}
@@ -1314,8 +1308,7 @@
return false;
}
- AttributeType type = DirectoryServer.getAttributeTypeOrDefault(
- OP_ATTR_PWPOLICY_RESET_REQUIRED_LC, OP_ATTR_PWPOLICY_RESET_REQUIRED);
+ AttributeType type = DirectoryServer.getAttributeTypeOrDefault(OP_ATTR_PWPOLICY_RESET_REQUIRED);
try
{
mustChangePassword = getBoolean(userEntry, type);
@@ -1362,8 +1355,7 @@
return; // requested state matches current state
}
- AttributeType type = DirectoryServer.getAttributeTypeOrDefault(
- OP_ATTR_PWPOLICY_RESET_REQUIRED_LC, OP_ATTR_PWPOLICY_RESET_REQUIRED);
+ AttributeType type = DirectoryServer.getAttributeTypeOrDefault(OP_ATTR_PWPOLICY_RESET_REQUIRED);
this.mustChangePassword = ConditionResult.not(this.mustChangePassword);
if (mustChangePassword)
{
@@ -1958,8 +1950,7 @@
{
if (graceLoginTimes == null)
{
- AttributeType type = DirectoryServer.getAttributeTypeOrDefault(
- OP_ATTR_PWPOLICY_GRACE_LOGIN_TIME_LC, OP_ATTR_PWPOLICY_GRACE_LOGIN_TIME);
+ AttributeType type = DirectoryServer.getAttributeTypeOrDefault(OP_ATTR_PWPOLICY_GRACE_LOGIN_TIME);
try
{
graceLoginTimes = getGeneralizedTimes(type);
@@ -2013,8 +2004,7 @@
long highestGraceTime = computeHighestTime(graceTimes);
graceTimes.add(highestGraceTime); // graceTimes == this.graceLoginTimes
- AttributeType type = DirectoryServer.getAttributeTypeOrDefault(
- OP_ATTR_PWPOLICY_GRACE_LOGIN_TIME_LC, OP_ATTR_PWPOLICY_GRACE_LOGIN_TIME);
+ AttributeType type = DirectoryServer.getAttributeTypeOrDefault(OP_ATTR_PWPOLICY_GRACE_LOGIN_TIME);
Attribute addAttr = Attributes.create(type, GeneralizedTimeSyntax.format(highestGraceTime));
modifications.add(new Modification(ModificationType.ADD, addAttr, true));
}
@@ -2090,8 +2080,7 @@
}
graceTimes.clear(); // graceTimes == this.graceLoginTimes
- AttributeType type = DirectoryServer.getAttributeTypeOrDefault(
- OP_ATTR_PWPOLICY_GRACE_LOGIN_TIME_LC, OP_ATTR_PWPOLICY_GRACE_LOGIN_TIME);
+ AttributeType type = DirectoryServer.getAttributeTypeOrDefault(OP_ATTR_PWPOLICY_GRACE_LOGIN_TIME);
modifications.add(new Modification(ModificationType.REPLACE, Attributes.empty(type), true));
}
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/protocols/ldap/LDAPFilter.java b/opendj-server-legacy/src/main/java/org/opends/server/protocols/ldap/LDAPFilter.java
index 8b70b72..272efc8 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/protocols/ldap/LDAPFilter.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/protocols/ldap/LDAPFilter.java
@@ -1910,7 +1910,7 @@
if (semicolonPos > 0)
{
String baseName = attributeType.substring(0, semicolonPos);
- attrType = DirectoryServer.getAttributeTypeOrDefault(toLowerCase(baseName), baseName);
+ attrType = DirectoryServer.getAttributeTypeOrDefault(baseName);
options = new HashSet<>();
StringTokenizer tokenizer =
new StringTokenizer(attributeType.substring(semicolonPos+1), ";");
@@ -1922,7 +1922,7 @@
else
{
options = null;
- attrType = DirectoryServer.getAttributeTypeOrDefault(toLowerCase(attributeType), attributeType);
+ attrType = DirectoryServer.getAttributeTypeOrDefault(attributeType);
}
}
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/tasks/ExportTask.java b/opendj-server-legacy/src/main/java/org/opends/server/tasks/ExportTask.java
index d2eb45e..fdaae78 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/tasks/ExportTask.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/tasks/ExportTask.java
@@ -492,7 +492,7 @@
HashSet<AttributeType> attributes = new HashSet<>();
for (String attrName : attributeStrings)
{
- attributes.add(DirectoryServer.getAttributeTypeOrDefault(attrName.toLowerCase(), attrName));
+ attributes.add(DirectoryServer.getAttributeTypeOrDefault(attrName));
}
return attributes;
}
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/tasks/ImportTask.java b/opendj-server-legacy/src/main/java/org/opends/server/tasks/ImportTask.java
index 94448ed..cd197f9 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/tasks/ImportTask.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/tasks/ImportTask.java
@@ -788,7 +788,7 @@
final HashSet<AttributeType> attrTypes = new HashSet<>(attrNames.size());
for (String attrName : attrNames)
{
- attrTypes.add(DirectoryServer.getAttributeTypeOrDefault(attrName.toLowerCase(), attrName));
+ attrTypes.add(DirectoryServer.getAttributeTypeOrDefault(attrName));
}
return attrTypes;
}
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/tools/ExportLDIF.java b/opendj-server-legacy/src/main/java/org/opends/server/tools/ExportLDIF.java
index 8dfa46a..7fcc7f2 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/tools/ExportLDIF.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/tools/ExportLDIF.java
@@ -830,7 +830,7 @@
Set<AttributeType> results = new HashSet<>();
for (String attrName : attributeArg.getValues())
{
- results.add(DirectoryServer.getAttributeTypeOrDefault(attrName.toLowerCase(), attrName));
+ results.add(DirectoryServer.getAttributeTypeOrDefault(attrName));
}
return results;
}
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/tools/ImportLDIF.java b/opendj-server-legacy/src/main/java/org/opends/server/tools/ImportLDIF.java
index a3d80c6..5f08b8d 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/tools/ImportLDIF.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/tools/ImportLDIF.java
@@ -720,7 +720,7 @@
}
else
{
- excludeAttributes.add(DirectoryServer.getAttributeTypeOrDefault(lowerName, attrName));
+ excludeAttributes.add(DirectoryServer.getAttributeTypeOrDefault(attrName));
}
}
}
@@ -748,7 +748,7 @@
}
else
{
- includeAttributes.add(DirectoryServer.getAttributeTypeOrDefault(lowerName, attrName));
+ includeAttributes.add(DirectoryServer.getAttributeTypeOrDefault(attrName));
}
}
}
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/types/AttributeBuilder.java b/opendj-server-legacy/src/main/java/org/opends/server/types/AttributeBuilder.java
index 6f3aca8..d65cb48 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/types/AttributeBuilder.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/types/AttributeBuilder.java
@@ -973,7 +973,7 @@
private static AttributeType getAttributeTypeOrDefault(String attributeName)
{
- return DirectoryServer.getAttributeTypeOrDefault(toLowerCase(attributeName), attributeName);
+ return DirectoryServer.getAttributeTypeOrDefault(attributeName);
}
/** The attribute type for this attribute. */
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/types/Attributes.java b/opendj-server-legacy/src/main/java/org/opends/server/types/Attributes.java
index e4b2f3c..07bfb34 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/types/Attributes.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/types/Attributes.java
@@ -26,8 +26,8 @@
*/
package org.opends.server.types;
+import static org.opends.server.core.DirectoryServer.*;
import static org.opends.server.util.CollectionUtils.*;
-import static org.opends.server.util.StaticUtils.*;
import java.util.Arrays;
import java.util.Collection;
@@ -36,7 +36,6 @@
import org.forgerock.opendj.ldap.ByteString;
import org.forgerock.opendj.ldap.schema.AttributeType;
-import org.opends.server.core.DirectoryServer;
/**
* This class contains various methods for manipulating
@@ -408,9 +407,4 @@
}
return builder.toAttribute();
}
-
- private static AttributeType getAttributeTypeOrDefault(String attributeName)
- {
- return DirectoryServer.getAttributeTypeOrDefault(toLowerCase(attributeName), attributeName);
- }
}
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/types/DN.java b/opendj-server-legacy/src/main/java/org/opends/server/types/DN.java
index d9389ee..b7b37aa 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/types/DN.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/types/DN.java
@@ -810,27 +810,16 @@
private static RDN newRDN(ByteString attrName, ByteString value)
{
- String lowerName = toLC(attrName);
- String attributeNameString = attrName.toString();
- AttributeType attrType = getAttributeTypeOrDefault(lowerName, attributeNameString);
-
- return new RDN(attrType, attributeNameString, value);
+ String name = attrName.toString();
+ AttributeType attrType = getAttributeTypeOrDefault(name);
+ return new RDN(attrType, name, value);
}
private static void addValue(ByteString attributeName, RDN rdn, ByteString empty)
{
- String lowerName = toLC(attributeName);
- String attributeNameString = attributeName.toString();
- AttributeType attrType = getAttributeTypeOrDefault(lowerName, attributeNameString);
-
- rdn.addValue(attrType, attributeNameString, empty);
- }
-
- private static String toLC(ByteString attributeName)
- {
- StringBuilder lowerName = new StringBuilder();
- toLowerCase(attributeName, lowerName, true);
- return lowerName.toString();
+ String name = attributeName.toString();
+ AttributeType attrType = getAttributeTypeOrDefault(name);
+ rdn.addValue(attrType, name, empty);
}
/**
@@ -1123,19 +1112,15 @@
private static RDN newRDN(StringBuilder attributeName, ByteString value)
{
- String name = attributeName.toString();
- String lowerName = toLowerCase(name);
- AttributeType attrType = getAttributeTypeOrDefault(lowerName, name);
-
+ String name = attributeName.toString();
+ AttributeType attrType = getAttributeTypeOrDefault(name);
return new RDN(attrType, name, value);
}
private static void addValue(StringBuilder attributeName, RDN rdn, ByteString empty)
{
String name = attributeName.toString();
- String lowerName = toLowerCase(name);
- AttributeType attrType = getAttributeTypeOrDefault(lowerName, name);
-
+ AttributeType attrType = getAttributeTypeOrDefault(name);
rdn.addValue(attrType, name, empty);
}
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/types/RDN.java b/opendj-server-legacy/src/main/java/org/opends/server/types/RDN.java
index 5c126b0..c974e62 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/types/RDN.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/types/RDN.java
@@ -667,12 +667,11 @@
// Create the new RDN with the provided information. However,
// don't return it yet because this could be a multi-valued RDN.
String name = attributeName.toString();
- String lowerName = toLowerCase(name);
// If using default is a problem, it will be caught later either
// by not finding the target entry or by not allowing the entry
// to be added.
- AttributeType attrType = DirectoryServer.getAttributeTypeOrDefault(lowerName, name);
+ AttributeType attrType = DirectoryServer.getAttributeTypeOrDefault(name);
RDN rdn = new RDN(attrType, name, parsedValue.toByteString());
@@ -781,8 +780,7 @@
if (pos >= length)
{
name = attributeName.toString();
- lowerName = toLowerCase(name);
- attrType = DirectoryServer.getAttributeTypeOrDefault(lowerName.toString(), name);
+ attrType = DirectoryServer.getAttributeTypeOrDefault(name);
rdn.addValue(attrType, name, ByteString.empty());
return rdn;
@@ -796,11 +794,10 @@
// Update the RDN to include the new attribute/value.
name = attributeName.toString();
- lowerName = toLowerCase(name);
// If using default is a problem, it will be caught later either
// by not finding the target entry or by not allowing the entry
// to be added.
- attrType = DirectoryServer.getAttributeTypeOrDefault(lowerName, name);
+ attrType = DirectoryServer.getAttributeTypeOrDefault(name);
rdn.addValue(attrType, name, parsedValue.toByteString());
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/util/LDIFReader.java b/opendj-server-legacy/src/main/java/org/opends/server/util/LDIFReader.java
index ab83cd9..9274024 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/util/LDIFReader.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/util/LDIFReader.java
@@ -800,15 +800,13 @@
String attrDescr = line.substring(0, colonPos);
final Attribute attribute = parseAttrDescription(attrDescr);
final String attrName = attribute.getName();
- final String lowerName = toLowerCase(attrName);
// Now parse the attribute value.
- ByteString value = parseSingleValue(lines, line, entryDN,
- colonPos, attrName);
+ ByteString value = parseSingleValue(lines, line, entryDN, colonPos, attrName);
// See if this is an objectclass or an attribute. Then get the
// corresponding definition and add the value to the appropriate hash.
- if (lowerName.equals("objectclass"))
+ if (attrName.equalsIgnoreCase("objectclass"))
{
if (! importConfig.includeObjectClasses())
{
@@ -840,7 +838,7 @@
}
else
{
- AttributeType attrType = DirectoryServer.getAttributeTypeOrDefault(lowerName, attrName);
+ AttributeType attrType = DirectoryServer.getAttributeTypeOrDefault(attrName);
if (! importConfig.includeAttribute(attrType))
{
if (logger.isTraceEnabled())
--
Gitblit v1.10.0