From 4f6891a8bd4d017a41b5f75748398ff59787501c Mon Sep 17 00:00:00 2001
From: Jean-Noël Rouvignac <jean-noel.rouvignac@forgerock.com>
Date: Thu, 15 Oct 2015 19:38:35 +0000
Subject: [PATCH] Renamed DirectoryServer.getAttributeType() to DirectoryServer.getAttributeTypeOrNull().
---
opendj-server-legacy/src/test/java/org/opends/server/backends/pluggable/ID2CountTest.java | 2
opendj-server-legacy/src/test/java/org/opends/server/extensions/FingerprintCertificateMapperTestCase.java | 17
opendj-server-legacy/src/test/java/org/opends/server/backends/jeb/TestBackendImpl.java | 8
opendj-server-legacy/src/main/java/org/opends/server/backends/jeb/DN2URI.java | 11
opendj-server-legacy/src/main/java/org/opends/server/backends/jeb/Importer.java | 2
opendj-server-legacy/src/main/java/org/opends/server/backends/jeb/VerifyJob.java | 2
opendj-server-legacy/src/test/java/org/opends/server/extensions/SubjectAttributeToUserAttributeCertificateMapperTestCase.java | 66 +--
opendj-server-legacy/src/test/java/org/opends/server/types/VirtualAttributeRuleTestCase.java | 2
opendj-server-legacy/src/test/java/org/opends/server/schema/GenericSchemaTestCase.java | 6
opendj-server-legacy/src/test/java/org/forgerock/opendj/adapter/server3x/ConvertersTestCase.java | 2
opendj-server-legacy/src/main/java/org/opends/server/types/RDN.java | 6
opendj-server-legacy/src/test/java/org/opends/server/core/SubentryPasswordPolicyTestCase.java | 15
opendj-server-legacy/src/test/java/org/opends/server/util/TestLDIFReader.java | 17
opendj-server-legacy/src/main/java/org/opends/server/replication/plugin/EntryHistorical.java | 8
opendj-server-legacy/src/main/java/org/opends/server/admin/AttributeTypePropertyDefinition.java | 2
opendj-server-legacy/src/test/java/org/opends/server/backends/pluggable/PluggableBackendImplTestCase.java | 6
opendj-server-legacy/src/test/java/org/opends/server/extensions/SubschemaSubentryVirtualAttributeProviderTestCase.java | 2
opendj-server-legacy/src/test/java/org/opends/server/extensions/ExactMatchIdentityMapperTestCase.java | 2
opendj-server-legacy/src/test/java/org/opends/server/extensions/IsMemberOfVirtualAttributeProviderTestCase.java | 2
opendj-server-legacy/src/test/java/org/opends/server/admin/AttributeTypePropertyDefinitionTest.java | 4
opendj-server-legacy/src/test/java/org/opends/server/extensions/VirtualStaticGroupTestCase.java | 4
opendj-server-legacy/src/main/java/org/opends/server/plugins/AttributeCleanupPlugin.java | 2
opendj-server-legacy/src/test/java/org/opends/server/core/AddOperationTestCase.java | 2
opendj-server-legacy/src/main/java/org/opends/server/backends/pluggable/EntryContainer.java | 2
opendj-server-legacy/src/main/java/org/opends/server/protocols/ldap/LDAPStatistics.java | 189 +++------
opendj-server-legacy/src/test/java/org/opends/server/extensions/SubjectDNToUserAttributeCertificateMapperTestCase.java | 25
opendj-server-legacy/src/test/java/org/opends/server/replication/UpdateOperationTest.java | 6
opendj-server-legacy/src/test/java/org/opends/server/admin/client/ldap/LDAPClientTest.java | 44 -
opendj-server-legacy/src/main/java/org/opends/server/replication/plugin/PersistentServerState.java | 6
opendj-server-legacy/src/test/java/org/opends/server/backends/jeb/TestVLVIndex.java | 11
opendj-server-legacy/src/test/java/org/opends/server/replication/GenerationIdTest.java | 2
opendj-server-legacy/src/test/java/org/opends/server/replication/DependencyTest.java | 10
opendj-server-legacy/src/main/java/org/opends/server/replication/plugin/FractionalLDIFImportPlugin.java | 2
opendj-server-legacy/src/test/java/org/opends/server/backends/pluggable/DN2IDTest.java | 2
opendj-server-legacy/src/main/java/org/opends/server/core/SubentryPasswordPolicy.java | 2
opendj-server-legacy/src/test/java/org/opends/server/backends/jeb/TestVerifyJob.java | 5
opendj-server-legacy/src/main/java/org/opends/server/plugins/ReferentialIntegrityPlugin.java | 11
opendj-server-legacy/src/test/java/org/opends/server/replication/plugin/AttrHistoricalMultipleTest.java | 2
opendj-server-legacy/src/test/java/org/opends/server/extensions/HasSubordinatesVirtualAttributeProviderTestCase.java | 2
opendj-server-legacy/src/main/java/org/opends/server/types/Entry.java | 40 -
opendj-server-legacy/src/main/java/org/opends/server/plugins/EntryUUIDPlugin.java | 2
opendj-server-legacy/src/test/java/org/opends/server/types/PrivilegeTestCase.java | 7
opendj-server-legacy/src/main/java/org/opends/server/replication/plugin/LDAPReplicationDomain.java | 19
opendj-server-legacy/src/test/java/org/opends/server/extensions/NumSubordinatesVirtualAttributeProviderTestCase.java | 2
opendj-server-legacy/src/test/java/org/opends/server/admin/server/DefaultBehaviorTest.java | 20
opendj-server-legacy/src/test/java/org/opends/server/types/VirtualAttributeTestCase.java | 2
opendj-server-legacy/src/test/java/org/opends/server/controls/ServerSideSortControlTestCase.java | 4
opendj-server-legacy/src/test/java/org/opends/server/backends/jeb/TestImportJob.java | 2
opendj-server-legacy/src/test/java/org/opends/server/extensions/EntryDNVirtualAttributeProviderTestCase.java | 2
opendj-server-legacy/src/test/java/org/opends/server/replication/protocol/ProtocolCompatibilityTest.java | 4
opendj-server-legacy/src/test/java/org/opends/server/backends/pluggable/StateTest.java | 2
opendj-server-legacy/src/main/java/org/opends/server/api/ClientConnection.java | 3
opendj-server-legacy/src/main/java/org/opends/server/core/DirectoryServer.java | 2
opendj-server-legacy/src/test/java/org/opends/server/extensions/StructuralObjectClassVirtualAttributeProviderTestCase.java | 2
opendj-server-legacy/src/main/java/org/opends/server/backends/pluggable/VerifyJob.java | 2
opendj-server-legacy/src/test/java/org/opends/server/extensions/EntryUUIDVirtualAttributeProviderTestCase.java | 2
opendj-server-legacy/src/main/java/org/opends/server/authorization/dseecompat/AciEffectiveRights.java | 10
opendj-server-legacy/src/test/java/org/opends/server/admin/client/ldap/AggregationClientTest.java | 9
opendj-server-legacy/src/test/java/org/opends/server/core/TestModifyDNOperation.java | 6
opendj-server-legacy/src/main/java/org/opends/server/authorization/dseecompat/PatternRDN.java | 13
opendj-server-legacy/src/main/java/org/opends/server/extensions/SMTPAccountStatusNotificationHandler.java | 2
opendj-server-legacy/src/test/java/org/opends/server/replication/plugin/HistoricalTest.java | 6
opendj-server-legacy/src/main/java/org/opends/server/backends/jeb/EntryContainer.java | 2
opendj-server-legacy/src/main/java/org/opends/server/replication/server/ReplicationServer.java | 2
opendj-server-legacy/src/main/java/org/opends/server/types/DN.java | 18
opendj-server-legacy/src/test/java/org/opends/server/core/PasswordPolicyTestCase.java | 6
opendj-server-legacy/src/test/java/org/opends/server/types/TestRDN.java | 4
opendj-server-legacy/src/main/java/org/opends/server/types/SearchFilter.java | 2
opendj-server-legacy/src/test/java/org/opends/server/core/SubentryManagerTestCase.java | 8
opendj-server-legacy/src/main/java/org/opends/server/backends/jeb/VLVIndex.java | 6
opendj-server-legacy/src/main/java/org/opends/server/config/ConfigEntry.java | 6
opendj-server-legacy/src/test/java/org/opends/server/types/AttributeBuilderTest.java | 2
opendj-server-legacy/src/test/java/org/opends/server/extensions/UserDefinedVirtualAttributeProviderTestCase.java | 6
opendj-server-legacy/src/main/java/org/opends/server/controls/ServerSideSortRequestControl.java | 4
opendj-server-legacy/src/test/java/org/opends/server/admin/server/AggregationServerTest.java | 6
opendj-server-legacy/src/test/java/org/opends/server/types/EntrySchemaCheckingTestCase.java | 6
opendj-server-legacy/src/main/java/org/opends/server/backends/task/RecurringTask.java | 15
opendj-server-legacy/src/test/java/org/opends/server/extensions/PasswordModifyExtendedOperationTestCase.java | 6
opendj-server-legacy/src/test/java/org/opends/server/plugins/LastModPluginTestCase.java | 8
opendj-server-legacy/src/test/java/org/opends/server/extensions/GoverningStructureRuleVirtualAttributeProviderTestCase.java | 2
opendj-server-legacy/src/main/java/org/opends/server/crypto/CryptoManagerImpl.java | 81 +---
opendj-server-legacy/src/test/java/org/opends/server/plugins/EntryUUIDPluginTestCase.java | 2
opendj-server-legacy/src/test/java/org/opends/server/replication/plugin/HistoricalCsnOrderingTest.java | 2
opendj-server-legacy/src/test/java/org/opends/server/types/SearchFilterTests.java | 4
opendj-server-legacy/src/test/java/org/opends/server/replication/protocol/SynchronizationMsgTest.java | 4
opendj-server-legacy/src/test/java/org/opends/server/backends/SchemaBackendTestCase.java | 32
opendj-server-legacy/src/test/java/org/opends/server/replication/plugin/FractionalReplicationTest.java | 12
opendj-server-legacy/src/test/java/org/opends/server/replication/plugin/ModifyConflictTest.java | 8
opendj-server-legacy/src/main/java/org/opends/server/backends/pluggable/VLVIndex.java | 2
opendj-server-legacy/src/test/java/org/opends/server/controls/VLVControlTestCase.java | 4
opendj-server-legacy/src/test/java/org/opends/server/types/TestEntry.java | 82 ++--
opendj-server-legacy/src/main/java/org/opends/server/backends/pluggable/DN2URI.java | 2
opendj-server-legacy/src/test/java/org/opends/server/extensions/EntityTagVirtualAttributeProviderTestCase.java | 6
opendj-server-legacy/src/test/java/org/opends/server/controls/MatchedValuesControlTest.java | 16
opendj-server-legacy/src/main/java/org/opends/server/extensions/SubjectAttributeToUserAttributeCertificateMapper.java | 4
95 files changed, 416 insertions(+), 628 deletions(-)
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 6b382b2..d0093d0 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
@@ -164,7 +164,7 @@
String name = value.trim().toLowerCase();
AttributeType type = isCheckSchema
- ? DirectoryServer.getAttributeType(name)
+ ? DirectoryServer.getAttributeTypeOrNull(name)
: DirectoryServer.getAttributeTypeOrDefault(name);
if (type == null) {
throw PropertyException.illegalPropertyValueException(this, value);
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/api/ClientConnection.java b/opendj-server-legacy/src/main/java/org/opends/server/api/ClientConnection.java
index c509c38..0f636b4 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/api/ClientConnection.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/api/ClientConnection.java
@@ -1066,8 +1066,7 @@
newPrivileges.addAll(DirectoryServer.getRootPrivileges());
}
- AttributeType privType =
- DirectoryServer.getAttributeType(OP_ATTR_PRIVILEGE_NAME);
+ AttributeType privType = DirectoryServer.getAttributeTypeOrNull(OP_ATTR_PRIVILEGE_NAME);
List<Attribute> attrList = entry.getAttribute(privType);
if (attrList != null)
{
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 120dd6f..c4d71e6 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,19 +232,15 @@
{
if (aclRights == null)
{
- aclRights = DirectoryServer.getAttributeType(aclRightsAttrStr
- .toLowerCase());
+ aclRights = DirectoryServer.getAttributeTypeOrNull(aclRightsAttrStr.toLowerCase());
}
-
if (aclRightsInfo == null)
{
- aclRightsInfo = DirectoryServer.getAttributeType(aclRightsInfoAttrStr
- .toLowerCase());
+ aclRightsInfo = DirectoryServer.getAttributeTypeOrNull(aclRightsInfoAttrStr.toLowerCase());
}
-
if (dnAttributeType == null)
{
- dnAttributeType = DirectoryServer.getAttributeType(dnAttrStr);
+ dnAttributeType = DirectoryServer.getAttributeTypeOrNull(dnAttrStr);
}
// Check if the attributes aclRights and aclRightsInfo were requested and
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 526a89a..c7b9a71 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
@@ -172,16 +172,14 @@
AttributeType thatType = rdn.getAttributeType(0);
if (!typePatterns[0].equals("*"))
{
- AttributeType thisType =
- DirectoryServer.getAttributeType(typePatterns[0].toLowerCase());
+ AttributeType thisType = DirectoryServer.getAttributeTypeOrNull(typePatterns[0].toLowerCase());
if (thisType == null || !thisType.equals(thatType))
{
return false;
}
}
- return matchValuePattern(valuePatterns.get(0), thatType,
- rdn.getAttributeValue(0));
+ return matchValuePattern(valuePatterns.get(0), thatType, rdn.getAttributeValue(0));
}
if (hasTypeWildcard)
@@ -207,7 +205,7 @@
for (int i = 0; i < numValues; i++)
{
String lowerName = typePatterns[i].toLowerCase();
- AttributeType type = DirectoryServer.getAttributeType(lowerName);
+ AttributeType type = DirectoryServer.getAttributeTypeOrNull(lowerName);
if (type == null)
{
return false;
@@ -225,9 +223,8 @@
return false;
}
- if (!matchValuePattern(patternMap.get(rdnKey),
- DirectoryServer.getAttributeType(rdnKey),
- rdnMap.get(rdnKey)))
+ AttributeType rdnAttrType = DirectoryServer.getAttributeTypeOrNull(rdnKey);
+ if (!matchValuePattern(patternMap.get(rdnKey), rdnAttrType, rdnMap.get(rdnKey)))
{
return false;
}
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/backends/jeb/DN2URI.java b/opendj-server-legacy/src/main/java/org/opends/server/backends/jeb/DN2URI.java
index a59d618..1cbfba4 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/backends/jeb/DN2URI.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/backends/jeb/DN2URI.java
@@ -82,16 +82,13 @@
* The standard attribute type that is used to specify the set of referral
* URLs in a referral entry.
*/
- private final AttributeType referralType =
- DirectoryServer.getAttributeType(ATTR_REFERRAL_URL);
+ private final AttributeType referralType = DirectoryServer.getAttributeTypeOrNull(ATTR_REFERRAL_URL);
/**
- * A flag that indicates whether there are any referrals contained in this
- * database. It should only be set to {@code false} when it is known that
- * there are no referrals.
+ * A flag that indicates whether there are any referrals contained in this database.
+ * It should only be set to {@code false} when it is known that there are no referrals.
*/
- private volatile ConditionResult containsReferrals =
- ConditionResult.UNDEFINED;
+ private volatile ConditionResult containsReferrals = ConditionResult.UNDEFINED;
/**
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/backends/jeb/EntryContainer.java b/opendj-server-legacy/src/main/java/org/opends/server/backends/jeb/EntryContainer.java
index ee182b5..ae5b276 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/backends/jeb/EntryContainer.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/backends/jeb/EntryContainer.java
@@ -275,7 +275,7 @@
}
AttributeType attrType =
- DirectoryServer.getAttributeType(sortAttrs[i].toLowerCase());
+ DirectoryServer.getAttributeTypeOrNull(sortAttrs[i].toLowerCase());
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/jeb/Importer.java b/opendj-server-legacy/src/main/java/org/opends/server/backends/jeb/Importer.java
index e02361d..e1284d6 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/backends/jeb/Importer.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/backends/jeb/Importer.java
@@ -3359,7 +3359,7 @@
{
throw attributeIndexNotConfigured(index);
}
- AttributeType attrType = DirectoryServer.getAttributeType(attrIndexParts[0]);
+ AttributeType attrType = DirectoryServer.getAttributeTypeOrNull(attrIndexParts[0]);
if (attrType == null)
{
throw attributeIndexNotConfigured(index);
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/backends/jeb/VLVIndex.java b/opendj-server-legacy/src/main/java/org/opends/server/backends/jeb/VLVIndex.java
index c6fc769..2557ae3 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/backends/jeb/VLVIndex.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/backends/jeb/VLVIndex.java
@@ -170,7 +170,7 @@
}
AttributeType attrType =
- DirectoryServer.getAttributeType(sortAttrs[i].toLowerCase());
+ DirectoryServer.getAttributeTypeOrNull(sortAttrs[i].toLowerCase());
if(attrType == null)
{
throw new ConfigException(ERR_CONFIG_VLV_INDEX_UNDEFINED_ATTR.get(sortAttrs[i], name));
@@ -1257,7 +1257,7 @@
return false;
}
- AttributeType attrType = DirectoryServer.getAttributeType(sortAttrs[i].toLowerCase());
+ AttributeType attrType = DirectoryServer.getAttributeTypeOrNull(sortAttrs[i].toLowerCase());
if(attrType == null)
{
unacceptableReasons.add(ERR_CONFIG_VLV_INDEX_UNDEFINED_ATTR.get(sortAttrs[i], name));
@@ -1351,7 +1351,7 @@
}
AttributeType attrType =
- DirectoryServer.getAttributeType(sortAttrs[i].toLowerCase());
+ DirectoryServer.getAttributeTypeOrNull(sortAttrs[i].toLowerCase());
if(attrType == null)
{
ccr.addMessage(ERR_CONFIG_VLV_INDEX_UNDEFINED_ATTR.get(sortKeys[i], name));
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/backends/jeb/VerifyJob.java b/opendj-server-legacy/src/main/java/org/opends/server/backends/jeb/VerifyJob.java
index 566a0c1..273fff4 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/backends/jeb/VerifyJob.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/backends/jeb/VerifyJob.java
@@ -210,7 +210,7 @@
}
else
{
- AttributeType attrType = DirectoryServer.getAttributeType(lowerName);
+ AttributeType attrType = DirectoryServer.getAttributeTypeOrNull(lowerName);
if (attrType == null)
{
throw new JebException(ERR_ATTRIBUTE_INDEX_NOT_CONFIGURED.get(index));
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/backends/pluggable/DN2URI.java b/opendj-server-legacy/src/main/java/org/opends/server/backends/pluggable/DN2URI.java
index 0b59449..38beda8 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/backends/pluggable/DN2URI.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/backends/pluggable/DN2URI.java
@@ -85,7 +85,7 @@
* The standard attribute type that is used to specify the set of referral
* URLs in a referral entry.
*/
- private final AttributeType referralType = DirectoryServer.getAttributeType(ATTR_REFERRAL_URL);
+ private final AttributeType referralType = DirectoryServer.getAttributeTypeOrNull(ATTR_REFERRAL_URL);
/**
* A flag that indicates whether there are any referrals contained in this
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 766b9a9..1e6c76b 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
@@ -310,7 +310,7 @@
return false;
}
- AttributeType attrType = DirectoryServer.getAttributeType(sortAttrs[i].toLowerCase());
+ AttributeType attrType = DirectoryServer.getAttributeTypeOrNull(sortAttrs[i].toLowerCase());
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 504a75e..2738a9d 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
@@ -313,7 +313,7 @@
throw new ConfigException(ERR_CONFIG_VLV_INDEX_UNDEFINED_ATTR.get(sortKeys[i], getName()));
}
- final AttributeType attrType = DirectoryServer.getAttributeType(sortAttrs[i].toLowerCase());
+ final AttributeType attrType = DirectoryServer.getAttributeTypeOrNull(sortAttrs[i].toLowerCase());
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/pluggable/VerifyJob.java b/opendj-server-legacy/src/main/java/org/opends/server/backends/pluggable/VerifyJob.java
index f16d960..85dd687 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/backends/pluggable/VerifyJob.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/backends/pluggable/VerifyJob.java
@@ -219,7 +219,7 @@
}
else
{
- AttributeType attrType = DirectoryServer.getAttributeType(lowerName);
+ AttributeType attrType = DirectoryServer.getAttributeTypeOrNull(lowerName);
if (attrType == null)
{
throw new StorageRuntimeException(ERR_ATTRIBUTE_INDEX_NOT_CONFIGURED.get(index).toString());
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 9a87554..6be86a0 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
@@ -188,7 +188,7 @@
// Get the schedule for this task.
- attrType = DirectoryServer.getAttributeType(ATTR_RECURRING_TASK_SCHEDULE.toLowerCase());
+ attrType = DirectoryServer.getAttributeTypeOrNull(ATTR_RECURRING_TASK_SCHEDULE.toLowerCase());
if (attrType == null)
{
attrType = DirectoryServer.getDefaultAttributeType(ATTR_RECURRING_TASK_SCHEDULE);
@@ -238,7 +238,7 @@
weekdayArray = taskArrays[WEEKDAY_INDEX];
// Get the class name from the entry. If there isn't one, then fail.
- attrType = DirectoryServer.getAttributeType(ATTR_TASK_CLASS.toLowerCase());
+ attrType = DirectoryServer.getAttributeTypeOrNull(ATTR_TASK_CLASS.toLowerCase());
if (attrType == null)
{
attrType = DirectoryServer.getDefaultAttributeType(ATTR_TASK_CLASS);
@@ -408,7 +408,7 @@
SimpleDateFormat df = new SimpleDateFormat("yyyyMMddHHmmssSSS");
String nextTaskID = task.getTaskID() + "-" + df.format(nextTaskDate);
String nextTaskIDName = NAME_PREFIX_TASK + "id";
- AttributeType taskIDAttrType = DirectoryServer.getAttributeType(nextTaskIDName);
+ AttributeType taskIDAttrType = DirectoryServer.getAttributeTypeOrNull(nextTaskIDName);
Attribute nextTaskIDAttr = Attributes.create(taskIDAttrType, nextTaskID);
nextTaskEntry.replaceAttribute(nextTaskIDAttr);
RDN nextTaskRDN = RDN.decode(nextTaskIDName + "=" + nextTaskID);
@@ -416,12 +416,9 @@
taskScheduler.getTaskBackend().getScheduledTasksParentDN());
nextTaskEntry.setDN(nextTaskDN);
- String nextTaskStartTimeName = NAME_PREFIX_TASK +
- "scheduled-start-time";
- AttributeType taskStartTimeAttrType =
- DirectoryServer.getAttributeType(nextTaskStartTimeName);
- Attribute nextTaskStartTimeAttr = Attributes.create(
- taskStartTimeAttrType, nextTaskStartTime);
+ String nextTaskStartTimeName = NAME_PREFIX_TASK + "scheduled-start-time";
+ AttributeType taskStartTimeAttrType = DirectoryServer.getAttributeTypeOrNull(nextTaskStartTimeName);
+ Attribute nextTaskStartTimeAttr = Attributes.create(taskStartTimeAttrType, nextTaskStartTime);
nextTaskEntry.replaceAttribute(nextTaskStartTimeAttr);
nextTask.initializeTaskInternal(serverContext, taskScheduler, nextTaskEntry);
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 f6177df..1506225 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
@@ -214,12 +214,10 @@
public void putConfigAttribute(ConfigAttribute attribute)
{
String name = attribute.getName();
- AttributeType attrType =
- DirectoryServer.getAttributeType(name.toLowerCase());
+ AttributeType attrType = DirectoryServer.getAttributeTypeOrNull(name.toLowerCase());
if (attrType == null)
{
- attrType =
- DirectoryServer.getDefaultAttributeType(name, attribute.getSyntax());
+ attrType = DirectoryServer.getDefaultAttributeType(name, attribute.getSyntax());
}
List<Attribute> attrs = new ArrayList<>(2);
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 e310650..bf40d9c 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
@@ -105,7 +105,7 @@
{
reader.readStartSequence();
String attrName = toLowerCase(reader.readOctetStringAsString());
- AttributeType attrType = DirectoryServer.getAttributeType(attrName);
+ AttributeType attrType = DirectoryServer.getAttributeTypeOrNull(attrName);
if (attrType == null)
{
//This attribute is not defined in the schema. There is no point
@@ -436,7 +436,7 @@
ArrayList<SortKey> sortKeys = new ArrayList<>();
for(String[] decodedKey : decodedKeyList)
{
- AttributeType attrType = DirectoryServer.getAttributeType(decodedKey[0].toLowerCase());
+ AttributeType attrType = DirectoryServer.getAttributeTypeOrNull(decodedKey[0].toLowerCase());
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 56253fc..0d08982 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
@@ -2640,7 +2640,7 @@
* @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 getAttributeType(String lowerName)
+ public static AttributeType getAttributeTypeOrNull(String lowerName)
{
return directoryServer.schema.getAttributeType(lowerName);
}
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 d76e5b9..a7e31dc 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
@@ -173,7 +173,7 @@
String value = getAttrValue(entry, PWD_ATTR_ATTRIBUTE);
if (value != null && value.length() > 0)
{
- this.pPasswordAttribute = DirectoryServer.getAttributeType(value.toLowerCase());
+ this.pPasswordAttribute = DirectoryServer.getAttributeTypeOrNull(value.toLowerCase());
if (this.pPasswordAttribute == null)
{
throw new DirectoryException(ResultCode.UNWILLING_TO_PERFORM,
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/crypto/CryptoManagerImpl.java b/opendj-server-legacy/src/main/java/org/opends/server/crypto/CryptoManagerImpl.java
index c27d3e4..d4e2782 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/crypto/CryptoManagerImpl.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/crypto/CryptoManagerImpl.java
@@ -64,7 +64,6 @@
import org.opends.server.admin.std.server.CryptoManagerCfg;
import org.opends.server.api.Backend;
import org.opends.server.backends.TrustStoreBackend;
-import org.opends.server.config.ConfigConstants;
import org.opends.server.core.AddOperation;
import org.opends.server.core.DirectoryServer;
import org.opends.server.core.ModifyOperation;
@@ -242,42 +241,25 @@
this.serverContext = serverContext;
if (!schemaInitDone) {
// Initialize various schema references.
- attrKeyID = DirectoryServer.getAttributeType(
- ConfigConstants.ATTR_CRYPTO_KEY_ID);
- attrPublicKeyCertificate = DirectoryServer.getAttributeType(
- ConfigConstants.ATTR_CRYPTO_PUBLIC_KEY_CERTIFICATE);
- attrTransformation = DirectoryServer.getAttributeType(
- ConfigConstants.ATTR_CRYPTO_CIPHER_TRANSFORMATION_NAME);
- attrMacAlgorithm = DirectoryServer.getAttributeType(
- ConfigConstants.ATTR_CRYPTO_MAC_ALGORITHM_NAME);
- attrSymmetricKey = DirectoryServer.getAttributeType(
- ConfigConstants.ATTR_CRYPTO_SYMMETRIC_KEY);
- attrInitVectorLength = DirectoryServer.getAttributeType(
- ConfigConstants.ATTR_CRYPTO_INIT_VECTOR_LENGTH_BITS);
- attrKeyLength = DirectoryServer.getAttributeType(
- ConfigConstants.ATTR_CRYPTO_KEY_LENGTH_BITS);
- attrCompromisedTime = DirectoryServer.getAttributeType(
- ConfigConstants.ATTR_CRYPTO_KEY_COMPROMISED_TIME);
- ocCertRequest = DirectoryServer.getObjectClass(
- "ds-cfg-self-signed-cert-request"); // TODO: ConfigConstants
- ocInstanceKey = DirectoryServer.getObjectClass(
- ConfigConstants.OC_CRYPTO_INSTANCE_KEY);
- ocCipherKey = DirectoryServer.getObjectClass(
- ConfigConstants.OC_CRYPTO_CIPHER_KEY);
- ocMacKey = DirectoryServer.getObjectClass(
- ConfigConstants.OC_CRYPTO_MAC_KEY);
+ attrKeyID = DirectoryServer.getAttributeTypeOrNull(ATTR_CRYPTO_KEY_ID);
+ attrPublicKeyCertificate = DirectoryServer.getAttributeTypeOrNull(ATTR_CRYPTO_PUBLIC_KEY_CERTIFICATE);
+ attrTransformation = DirectoryServer.getAttributeTypeOrNull(ATTR_CRYPTO_CIPHER_TRANSFORMATION_NAME);
+ attrMacAlgorithm = DirectoryServer.getAttributeTypeOrNull(ATTR_CRYPTO_MAC_ALGORITHM_NAME);
+ attrSymmetricKey = DirectoryServer.getAttributeTypeOrNull(ATTR_CRYPTO_SYMMETRIC_KEY);
+ attrInitVectorLength = DirectoryServer.getAttributeTypeOrNull(ATTR_CRYPTO_INIT_VECTOR_LENGTH_BITS);
+ attrKeyLength = DirectoryServer.getAttributeTypeOrNull(ATTR_CRYPTO_KEY_LENGTH_BITS);
+ attrCompromisedTime = DirectoryServer.getAttributeTypeOrNull(ATTR_CRYPTO_KEY_COMPROMISED_TIME);
+ ocCertRequest = DirectoryServer.getObjectClass("ds-cfg-self-signed-cert-request"); // TODO: ConfigConstants
+ ocInstanceKey = DirectoryServer.getObjectClass(OC_CRYPTO_INSTANCE_KEY);
+ ocCipherKey = DirectoryServer.getObjectClass(OC_CRYPTO_CIPHER_KEY);
+ ocMacKey = DirectoryServer.getObjectClass(OC_CRYPTO_MAC_KEY);
try {
- localTruststoreDN
- = DN.valueOf(ConfigConstants.DN_TRUST_STORE_ROOT);
- DN adminSuffixDN = DN.valueOf(
- ADSContext.getAdministrationSuffixDN());
- instanceKeysDN = adminSuffixDN.child(
- DN.valueOf("cn=instance keys"));
- secretKeysDN = adminSuffixDN.child(
- DN.valueOf("cn=secret keys"));
- serversDN = adminSuffixDN.child(
- DN.valueOf("cn=Servers"));
+ localTruststoreDN = DN.valueOf(DN_TRUST_STORE_ROOT);
+ DN adminSuffixDN = DN.valueOf(ADSContext.getAdministrationSuffixDN());
+ instanceKeysDN = adminSuffixDN.child(DN.valueOf("cn=instance keys"));
+ secretKeysDN = adminSuffixDN.child(DN.valueOf("cn=secret keys"));
+ serversDN = adminSuffixDN.child(DN.valueOf("cn=Servers"));
}
catch (DirectoryException ex) {
logger.traceException(ex);
@@ -458,16 +440,14 @@
private TrustStoreBackend getTrustStoreBackend()
throws ConfigException
{
- Backend<?> b = DirectoryServer.getBackend(ConfigConstants.ID_ADS_TRUST_STORE_BACKEND);
+ Backend<?> b = DirectoryServer.getBackend(ID_ADS_TRUST_STORE_BACKEND);
if (b == null)
{
- throw new ConfigException(ERR_CRYPTOMGR_ADS_TRUST_STORE_BACKEND_NOT_ENABLED.get(
- ConfigConstants.ID_ADS_TRUST_STORE_BACKEND));
+ throw new ConfigException(ERR_CRYPTOMGR_ADS_TRUST_STORE_BACKEND_NOT_ENABLED.get(ID_ADS_TRUST_STORE_BACKEND));
}
if (!(b instanceof TrustStoreBackend))
{
- throw new ConfigException(ERR_CRYPTOMGR_ADS_TRUST_STORE_BACKEND_WRONG_CLASS.get(
- ConfigConstants.ID_ADS_TRUST_STORE_BACKEND));
+ throw new ConfigException(ERR_CRYPTOMGR_ADS_TRUST_STORE_BACKEND_WRONG_CLASS.get(ID_ADS_TRUST_STORE_BACKEND));
}
return (TrustStoreBackend)b;
}
@@ -490,9 +470,8 @@
static byte[] getInstanceKeyCertificateFromLocalTruststore()
throws CryptoManagerException {
// Construct the key entry DN.
- final ByteString distinguishedValue = ByteString.valueOf(ConfigConstants.ADS_CERTIFICATE_ALIAS);
- final DN entryDN = localTruststoreDN.child(
- RDN.create(attrKeyID, distinguishedValue));
+ final ByteString distinguishedValue = ByteString.valueOf(ADS_CERTIFICATE_ALIAS);
+ final DN entryDN = localTruststoreDN.child(RDN.create(attrKeyID, distinguishedValue));
// Construct the search filter.
final String FILTER_OC_INSTANCE_KEY = "(objectclass=" + ocInstanceKey.getNameOrOID() + ")";
// Construct the attribute list.
@@ -857,8 +836,7 @@
// Retrieve instance-key-pair private key part.
PrivateKey privateKey;
try {
- privateKey = (PrivateKey) getTrustStoreBackend()
- .getKey(ConfigConstants.ADS_CERTIFICATE_ALIAS);
+ privateKey = (PrivateKey) getTrustStoreBackend().getKey(ADS_CERTIFICATE_ALIAS);
}
catch(ConfigException ce)
{
@@ -1099,12 +1077,9 @@
secretKey, keyLengthBits, ivLengthBits, isCompromised);
// Write the value to the entry.
- InternalClientConnection internalConnection =
- InternalClientConnection.getRootConnection();
- Attribute attribute = Attributes.create(
- ConfigConstants.ATTR_CRYPTO_SYMMETRIC_KEY, symmetricKey);
- List<Modification> modifications = newArrayList(
- new Modification(ModificationType.ADD, attribute, false));
+ InternalClientConnection internalConnection = getRootConnection();
+ Attribute attribute = Attributes.create(ATTR_CRYPTO_SYMMETRIC_KEY, symmetricKey);
+ List<Modification> modifications = newArrayList(new Modification(ModificationType.ADD, attribute, false));
ModifyOperation internalModify = internalConnection.processModify(entry.getName(), modifications);
if (internalModify.getResultCode() != ResultCode.SUCCESS)
{
@@ -2170,9 +2145,7 @@
// Create the entry.
Entry entry = new Entry(entryDN, ocMap, userAttrs, opAttrs);
- InternalClientConnection connection =
- InternalClientConnection.getRootConnection();
- AddOperation addOperation = connection.processAdd(entry);
+ AddOperation addOperation = getRootConnection().processAdd(entry);
if (addOperation.getResultCode() != ResultCode.SUCCESS)
{
throw new CryptoManagerException(
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/extensions/SMTPAccountStatusNotificationHandler.java b/opendj-server-legacy/src/main/java/org/opends/server/extensions/SMTPAccountStatusNotificationHandler.java
index 5353ee4..5be10d5 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/extensions/SMTPAccountStatusNotificationHandler.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/extensions/SMTPAccountStatusNotificationHandler.java
@@ -391,7 +391,7 @@
else if (lowerTokenStr.startsWith("notification-user-attr:"))
{
String attrName = lowerTokenStr.substring(23);
- AttributeType attrType = DirectoryServer.getAttributeType(attrName);
+ AttributeType attrType = DirectoryServer.getAttributeTypeOrNull(attrName);
if (attrType == null)
{
throw new ConfigException(
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/extensions/SubjectAttributeToUserAttributeCertificateMapper.java b/opendj-server-legacy/src/main/java/org/opends/server/extensions/SubjectAttributeToUserAttributeCertificateMapper.java
index f4a8fe0..5e4ca30 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/extensions/SubjectAttributeToUserAttributeCertificateMapper.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/extensions/SubjectAttributeToUserAttributeCertificateMapper.java
@@ -399,7 +399,7 @@
return null;
}
- AttributeType userAttrType = DirectoryServer.getAttributeType(userAttrName);
+ AttributeType userAttrType = DirectoryServer.getAttributeTypeOrNull(userAttrName);
if (userAttrType == null)
{
ccr.setResultCodeIfSuccess(ResultCode.CONSTRAINT_VIOLATION);
@@ -429,7 +429,7 @@
*/
private static String normalizeAttributeName(String attrName)
{
- AttributeType attrType = DirectoryServer.getAttributeType(attrName);
+ AttributeType attrType = DirectoryServer.getAttributeTypeOrNull(attrName);
if (attrType != null)
{
String attrNameNormalized = attrType.getNormalizedPrimaryNameOrOID();
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 395d35a..621e954 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
@@ -306,7 +306,7 @@
? toAttr
: toAttr.substring(semicolonPos + 1);
- if (DirectoryServer.getAttributeType(toLowerCase(toAttrType)) == null)
+ if (DirectoryServer.getAttributeTypeOrNull(toLowerCase(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/EntryUUIDPlugin.java b/opendj-server-legacy/src/main/java/org/opends/server/plugins/EntryUUIDPlugin.java
index b5b9d5f..4a4d47d 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/plugins/EntryUUIDPlugin.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/plugins/EntryUUIDPlugin.java
@@ -90,7 +90,7 @@
// Get the entryUUID attribute type. This needs to be done in the
// constructor in order to make the associated variables "final".
- AttributeType at = DirectoryServer.getAttributeType(ENTRYUUID);
+ AttributeType at = DirectoryServer.getAttributeTypeOrNull(ENTRYUUID);
if (at == null)
{
String definition =
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 625f22f..6ed86d6 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
@@ -222,13 +222,10 @@
String attr = attrFilt.substring(0, sepInd);
String filtStr = attrFilt.substring(sepInd + 1);
- AttributeType attrType =
- DirectoryServer.getAttributeType(attr.toLowerCase());
-
+ AttributeType attrType = DirectoryServer.getAttributeTypeOrNull(attr.toLowerCase());
try
{
- SearchFilter filter =
- SearchFilter.createFilterFromString(filtStr);
+ SearchFilter filter = SearchFilter.createFilterFromString(filtStr);
newAttrFiltMap.put(attrType, filter);
}
catch (DirectoryException de)
@@ -348,9 +345,7 @@
* type has to be present in the attributeType list.
*/
- AttributeType attrType =
- DirectoryServer.getAttributeType(attr.toLowerCase());
-
+ AttributeType attrType = DirectoryServer.getAttributeTypeOrNull(attr.toLowerCase());
if (attrType == null || !theAttributeTypes.contains(attrType))
{
isAcceptable = false;
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/protocols/ldap/LDAPStatistics.java b/opendj-server-legacy/src/main/java/org/opends/server/protocols/ldap/LDAPStatistics.java
index b57e9af..c6d063b 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/protocols/ldap/LDAPStatistics.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/protocols/ldap/LDAPStatistics.java
@@ -35,11 +35,16 @@
import java.util.concurrent.atomic.AtomicLong;
import org.forgerock.i18n.LocalizableMessage;
+import org.forgerock.opendj.config.server.ConfigException;
import org.opends.server.admin.std.server.MonitorProviderCfg;
import org.opends.server.api.MonitorProvider;
-import org.forgerock.opendj.config.server.ConfigException;
import org.opends.server.core.DirectoryServer;
-import org.opends.server.types.*;
+import org.opends.server.types.Attribute;
+import org.opends.server.types.AttributeType;
+import org.opends.server.types.Attributes;
+import org.opends.server.types.DirectoryConfig;
+import org.opends.server.types.ObjectClass;
+import org.opends.server.types.OperationType;
/**
* This class defines a data structure that will be used to keep track
@@ -250,141 +255,77 @@
* and associated with their objectclass
* OC_MONITOR_CONNHANDLERSTATS
*/
- attrs.add(createAttribute("connectionsEstablished", String
- .valueOf(tmpConnectionsEstablished)));
- attrs.add(createAttribute("connectionsClosed", String
- .valueOf(tmpConnectionsClosed)));
- attrs.add(createAttribute("bytesRead", String
- .valueOf(tmpBytesRead)));
- attrs.add(createAttribute("bytesWritten", String
- .valueOf(tmpBytesWritten)));
- attrs.add(createAttribute("ldapMessagesRead", String
- .valueOf(tmpMessagesRead)));
- attrs.add(createAttribute("ldapMessagesWritten", String
- .valueOf(tmpMessagesWritten)));
- attrs.add(createAttribute("operationsAbandoned", String
- .valueOf(tmpOperationsAbandoned)));
- attrs.add(createAttribute("operationsInitiated", String
- .valueOf(tmpOperationsInitiated)));
- attrs.add(createAttribute("operationsCompleted", String
- .valueOf(tmpOperationsCompleted)));
- attrs.add(createAttribute("abandonRequests", String
- .valueOf(tmpAbandonRequests)));
- attrs.add(createAttribute("addRequests", String
- .valueOf(tmpAddRequests)));
- attrs.add(createAttribute("addResponses", String
- .valueOf(tmpAddResponses)));
- attrs.add(createAttribute("bindRequests", String
- .valueOf(tmpBindRequests)));
- attrs.add(createAttribute("bindResponses", String
- .valueOf(tmpBindResponses)));
- attrs.add(createAttribute("compareRequests", String
- .valueOf(tmpCompareRequests)));
- attrs.add(createAttribute("compareResponses", String
- .valueOf(tmpCompareResponses)));
- attrs.add(createAttribute("deleteRequests", String
- .valueOf(tmpDeleteRequests)));
- attrs.add(createAttribute("deleteResponses", String
- .valueOf(tmpDeleteResponses)));
- attrs.add(createAttribute("extendedRequests", String
- .valueOf(tmpExtendedRequests)));
- attrs.add(createAttribute("extendedResponses", String
- .valueOf(tmpExtendedResponses)));
- attrs.add(createAttribute("modifyRequests", String
- .valueOf(tmpModifyRequests)));
- attrs.add(createAttribute("modifyResponses", String
- .valueOf(tmpModifyResponses)));
- attrs.add(createAttribute("modifyDNRequests", String
- .valueOf(tmpModifyDNRequests)));
- attrs.add(createAttribute("modifyDNResponses", String
- .valueOf(tmpModifyDNResponses)));
- attrs.add(createAttribute("searchRequests", String
- .valueOf(tmpSearchRequests)));
- attrs.add(createAttribute("searchOneRequests", String
- .valueOf(tmpSearchOneRequests)));
- attrs.add(createAttribute("searchSubRequests", String
- .valueOf(tmpSearchSubRequests)));
- attrs.add(createAttribute("searchResultEntries", String
- .valueOf(tmpSearchEntries)));
- attrs.add(createAttribute("searchResultReferences", String
- .valueOf(tmpSearchReferences)));
- attrs.add(createAttribute("searchResultsDone", String
- .valueOf(tmpSearchResultsDone)));
- attrs.add(createAttribute("unbindRequests", String
- .valueOf(tmpUnbindRequests)));
+ attrs.add(createAttribute("connectionsEstablished", tmpConnectionsEstablished));
+ attrs.add(createAttribute("connectionsClosed", tmpConnectionsClosed));
+ attrs.add(createAttribute("bytesRead", tmpBytesRead));
+ attrs.add(createAttribute("bytesWritten", tmpBytesWritten));
+ attrs.add(createAttribute("ldapMessagesRead", tmpMessagesRead));
+ attrs.add(createAttribute("ldapMessagesWritten", tmpMessagesWritten));
+ attrs.add(createAttribute("operationsAbandoned", tmpOperationsAbandoned));
+ attrs.add(createAttribute("operationsInitiated", tmpOperationsInitiated));
+ attrs.add(createAttribute("operationsCompleted", tmpOperationsCompleted));
+ attrs.add(createAttribute("abandonRequests", tmpAbandonRequests));
+ attrs.add(createAttribute("addRequests", tmpAddRequests));
+ attrs.add(createAttribute("addResponses", tmpAddResponses));
+ attrs.add(createAttribute("bindRequests", tmpBindRequests));
+ attrs.add(createAttribute("bindResponses", tmpBindResponses));
+ attrs.add(createAttribute("compareRequests", tmpCompareRequests));
+ attrs.add(createAttribute("compareResponses", tmpCompareResponses));
+ attrs.add(createAttribute("deleteRequests", tmpDeleteRequests));
+ attrs.add(createAttribute("deleteResponses", tmpDeleteResponses));
+ attrs.add(createAttribute("extendedRequests", tmpExtendedRequests));
+ attrs.add(createAttribute("extendedResponses", tmpExtendedResponses));
+ attrs.add(createAttribute("modifyRequests", tmpModifyRequests));
+ attrs.add(createAttribute("modifyResponses", tmpModifyResponses));
+ attrs.add(createAttribute("modifyDNRequests", tmpModifyDNRequests));
+ attrs.add(createAttribute("modifyDNResponses", tmpModifyDNResponses));
+ attrs.add(createAttribute("searchRequests", tmpSearchRequests));
+ attrs.add(createAttribute("searchOneRequests", tmpSearchOneRequests));
+ attrs.add(createAttribute("searchSubRequests", tmpSearchSubRequests));
+ attrs.add(createAttribute("searchResultEntries", tmpSearchEntries));
+ attrs.add(createAttribute("searchResultReferences", tmpSearchReferences));
+ attrs.add(createAttribute("searchResultsDone", tmpSearchResultsDone));
+ attrs.add(createAttribute("unbindRequests", tmpUnbindRequests));
// adds
- attrs.add(createAttribute("ds-mon-add-operations-total-count",
- String.valueOf(tmpAddOperationCount)));
-
- attrs.add(createAttribute(
- "ds-mon-resident-time-add-operations-total-time", String
- .valueOf(tmpAddOperationTime)));
+ attrs.add(createAttribute("ds-mon-add-operations-total-count", tmpAddOperationCount));
+ attrs.add(createAttribute("ds-mon-resident-time-add-operations-total-time", tmpAddOperationTime));
// search
- attrs.add(createAttribute("ds-mon-search-operations-total-count",
- String.valueOf(tmpSearchOperationCount)));
- attrs.add(createAttribute(
- "ds-mon-resident-time-search-operations-total-time", String
- .valueOf(tmpSearchOperationTime)));
+ attrs.add(createAttribute("ds-mon-search-operations-total-count", tmpSearchOperationCount));
+ attrs.add(createAttribute("ds-mon-resident-time-search-operations-total-time", tmpSearchOperationTime));
// bind
- attrs.add(createAttribute("ds-mon-bind-operations-total-count",
- String.valueOf(tmpBindOperationCount)));
- attrs.add(createAttribute(
- "ds-mon-resident-time-bind-operations-total-time", String
- .valueOf(tmpBindOperationTime)));
+ attrs.add(createAttribute("ds-mon-bind-operations-total-count", tmpBindOperationCount));
+ attrs.add(createAttribute("ds-mon-resident-time-bind-operations-total-time", tmpBindOperationTime));
// unbind
- attrs.add(createAttribute("ds-mon-unbind-operations-total-count",
- String.valueOf(tmpUnbindOperationCount)));
- attrs.add(createAttribute(
- "ds-mon-resident-time-unbind-operations-total-time", String
- .valueOf(tmpUnbindOperationTime)));
+ attrs.add(createAttribute("ds-mon-unbind-operations-total-count", tmpUnbindOperationCount));
+ attrs.add(createAttribute("ds-mon-resident-time-unbind-operations-total-time", tmpUnbindOperationTime));
// compare
- attrs
- .add(createAttribute("ds-mon-compare-operations-total-count",
- String.valueOf(tmpCompOperationCount)));
- attrs.add(createAttribute(
- "ds-mon-resident-time-compare-operations-total-time", String
- .valueOf(tmpCompOperationTime)));
+ attrs.add(createAttribute("ds-mon-compare-operations-total-count", tmpCompOperationCount));
+ attrs.add(createAttribute("ds-mon-resident-time-compare-operations-total-time", tmpCompOperationTime));
+
// del
- attrs.add(createAttribute("ds-mon-delete-operations-total-count",
- String.valueOf(tmpDelOperationCount)));
- attrs.add(createAttribute(
- "ds-mon-resident-time-delete-operations-total-time", String
- .valueOf(tmpDelOperationTime)));
+ attrs.add(createAttribute("ds-mon-delete-operations-total-count", tmpDelOperationCount));
+ attrs.add(createAttribute("ds-mon-resident-time-delete-operations-total-time", tmpDelOperationTime));
// mod
- attrs.add(createAttribute("ds-mon-mod-operations-total-count",
- String.valueOf(tmpModOperationCount)));
- attrs.add(createAttribute(
- "ds-mon-resident-time-mod-operations-total-time", String
- .valueOf(tmpModOperationTime)));
+ attrs.add(createAttribute("ds-mon-mod-operations-total-count", tmpModOperationCount));
+ attrs.add(createAttribute("ds-mon-resident-time-mod-operations-total-time", tmpModOperationTime));
// moddn
- attrs.add(createAttribute("ds-mon-moddn-operations-total-count",
- String.valueOf(tmpModdnOperationCount)));
- attrs.add(createAttribute(
- "ds-mon-resident-time-moddn-operations-total-time", String
- .valueOf(tmpModdnOperationTime)));
+ attrs.add(createAttribute("ds-mon-moddn-operations-total-count", tmpModdnOperationCount));
+ attrs.add(createAttribute("ds-mon-resident-time-moddn-operations-total-time", tmpModdnOperationTime));
// abandon
- attrs
- .add(createAttribute("ds-mon-abandon-operations-total-count",
- String.valueOf(tmpAbandonOperationCount)));
- attrs.add(createAttribute(
- "ds-mon-resident-time-abandon-operations-total-time", String
- .valueOf(tmpAbandonOperationTime)));
+ attrs.add(createAttribute("ds-mon-abandon-operations-total-count", tmpAbandonOperationCount));
+ attrs.add(createAttribute("ds-mon-resident-time-abandon-operations-total-time", tmpAbandonOperationTime));
// extended
- attrs
- .add(createAttribute("ds-mon-extended-operations-total-count",
- String.valueOf(tmpExtOperationCount)));
- attrs.add(createAttribute(
- "ds-mon-resident-time-extended-operations-total-time", String
- .valueOf(tmpExtOperationTime)));
+ attrs.add(createAttribute("ds-mon-extended-operations-total-count", tmpExtOperationCount));
+ attrs.add(createAttribute("ds-mon-resident-time-extended-operations-total-time", tmpExtOperationTime));
return attrs;
}
@@ -651,11 +592,10 @@
* The value to use for the attribute.
* @return the constructed attribute.
*/
- protected Attribute createAttribute(String name, String value)
+ protected Attribute createAttribute(String name, Object value)
{
- AttributeType attrType =
- DirectoryServer.getAttributeType(name.toLowerCase());
- return Attributes.create(attrType, value);
+ AttributeType attrType = DirectoryServer.getAttributeTypeOrNull(name.toLowerCase());
+ return Attributes.create(attrType, String.valueOf(value));
}
@@ -669,7 +609,7 @@
*/
public long getConnectionsEstablished()
{
- return connectionsEstablished.get();
+ return connectionsEstablished.get();
}
@@ -681,8 +621,7 @@
*/
public long getConnectionsClosed()
{
- return connectionsClosed.get();
-
+ return connectionsClosed.get();
}
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/replication/plugin/EntryHistorical.java b/opendj-server-legacy/src/main/java/org/opends/server/replication/plugin/EntryHistorical.java
index 49a0de2..9b5e326 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/replication/plugin/EntryHistorical.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/replication/plugin/EntryHistorical.java
@@ -256,7 +256,7 @@
*/
public static void setHistoricalAttrToOperation(PreOperationAddOperation addOperation)
{
- AttributeType attrType = DirectoryServer.getAttributeType(HISTORICAL_ATTRIBUTE_NAME);
+ AttributeType attrType = DirectoryServer.getAttributeTypeOrNull(HISTORICAL_ATTRIBUTE_NAME);
String attrValue = encodeHistorical(OperationContext.getCSN(addOperation), "add");
List<Attribute> attrs = Attributes.createAsList(attrType, attrValue);
addOperation.setAttribute(attrType, attrs);
@@ -344,7 +344,7 @@
purgeDate = TimeThread.getTime() - purgeDelayInMillisec;
}
- AttributeType historicalAttrType = DirectoryServer.getAttributeType(HISTORICAL_ATTRIBUTE_NAME);
+ AttributeType historicalAttrType = DirectoryServer.getAttributeTypeOrNull(HISTORICAL_ATTRIBUTE_NAME);
AttributeBuilder builder = new AttributeBuilder(historicalAttrType);
for (Map.Entry<AttributeDescription, AttrHistorical> mapEntry : attributesHistorical.entrySet())
@@ -677,7 +677,7 @@
*/
public static String getEntryUUID(Entry entry)
{
- AttributeType attrType = DirectoryServer.getAttributeType(ENTRYUUID_ATTRIBUTE_NAME);
+ AttributeType attrType = DirectoryServer.getAttributeTypeOrNull(ENTRYUUID_ATTRIBUTE_NAME);
List<Attribute> uuidAttrs = entry.getOperationalAttribute(attrType);
return extractEntryUUID(uuidAttrs, entry.getName());
}
@@ -692,7 +692,7 @@
*/
public static String getEntryUUID(PreOperationAddOperation op)
{
- AttributeType attrType = DirectoryServer.getAttributeType(ENTRYUUID_ATTRIBUTE_NAME);
+ AttributeType attrType = DirectoryServer.getAttributeTypeOrNull(ENTRYUUID_ATTRIBUTE_NAME);
List<Attribute> uuidAttrs = op.getOperationalAttributes().get(attrType);
return extractEntryUUID(uuidAttrs, op.getEntryDN());
}
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/replication/plugin/FractionalLDIFImportPlugin.java b/opendj-server-legacy/src/main/java/org/opends/server/replication/plugin/FractionalLDIFImportPlugin.java
index 477481d..ff39129 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/replication/plugin/FractionalLDIFImportPlugin.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/replication/plugin/FractionalLDIFImportPlugin.java
@@ -402,7 +402,7 @@
private Attribute getAttribute(String attributeName, Entry entry)
{
- AttributeType attrType = DirectoryServer.getAttributeType(attributeName);
+ AttributeType attrType = DirectoryServer.getAttributeTypeOrNull(attributeName);
List<Attribute> inclAttrs = entry.getAttribute(attrType);
if (inclAttrs != null)
{
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/replication/plugin/LDAPReplicationDomain.java b/opendj-server-legacy/src/main/java/org/opends/server/replication/plugin/LDAPReplicationDomain.java
index ba6c5ee..50244f1 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/replication/plugin/LDAPReplicationDomain.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/replication/plugin/LDAPReplicationDomain.java
@@ -704,10 +704,8 @@
final SearchResultEntry resultEntry = getFirstResult(searchOperation);
if (resultEntry != null)
{
- AttributeType synchronizationGenIDType =
- DirectoryServer.getAttributeType(REPLICATION_GENERATION_ID);
- List<Attribute> attrs =
- resultEntry.getAttribute(synchronizationGenIDType);
+ AttributeType synchronizationGenIDType = DirectoryServer.getAttributeTypeOrNull(REPLICATION_GENERATION_ID);
+ List<Attribute> attrs = resultEntry.getAttribute(synchronizationGenIDType);
if (attrs != null)
{
Attribute attr = attrs.get(0);
@@ -725,10 +723,9 @@
return null;
}
- private Iterator<String> getAttributeValueIterator(
- SearchResultEntry resultEntry, String attrName)
+ private Iterator<String> getAttributeValueIterator(SearchResultEntry resultEntry, String attrName)
{
- AttributeType attrType = DirectoryServer.getAttributeType(attrName);
+ AttributeType attrType = DirectoryServer.getAttributeTypeOrNull(attrName);
List<Attribute> exclAttrs = resultEntry.getAttribute(attrType);
if (exclAttrs != null)
{
@@ -1142,7 +1139,7 @@
{
for (String attrName : attrNames)
{
- if (DirectoryServer.getAttributeType(attrName).equals(attrTypeToFind))
+ if (DirectoryServer.getAttributeTypeOrNull(attrName).equals(attrTypeToFind))
{
return true;
}
@@ -3282,10 +3279,8 @@
SearchResultEntry resultEntry = result.get(0);
if (resultEntry != null)
{
- AttributeType synchronizationGenIDType =
- DirectoryServer.getAttributeType(REPLICATION_GENERATION_ID);
- List<Attribute> attrs =
- resultEntry.getAttribute(synchronizationGenIDType);
+ AttributeType synchronizationGenIDType = DirectoryServer.getAttributeTypeOrNull(REPLICATION_GENERATION_ID);
+ List<Attribute> attrs = resultEntry.getAttribute(synchronizationGenIDType);
if (attrs != null)
{
Attribute attr = attrs.get(0);
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/replication/plugin/PersistentServerState.java b/opendj-server-legacy/src/main/java/org/opends/server/replication/plugin/PersistentServerState.java
index 5e0aa48..da275e7 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/replication/plugin/PersistentServerState.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/replication/plugin/PersistentServerState.java
@@ -220,8 +220,7 @@
*/
private void updateStateFromEntry(SearchResultEntry resultEntry)
{
- AttributeType synchronizationStateType =
- DirectoryServer.getAttributeType(REPLICATION_STATE);
+ AttributeType synchronizationStateType = DirectoryServer.getAttributeTypeOrNull(REPLICATION_STATE);
List<Attribute> attrs = resultEntry.getAttribute(synchronizationStateType);
if (attrs != null)
{
@@ -318,8 +317,7 @@
*/
private final void checkAndUpdateServerState()
{
- final AttributeType histType = DirectoryServer.getAttributeType(
- EntryHistorical.HISTORICAL_ATTRIBUTE_NAME);
+ final AttributeType histType = DirectoryServer.getAttributeTypeOrNull(EntryHistorical.HISTORICAL_ATTRIBUTE_NAME);
// Retrieves the entries that have changed since the
// maxCsn stored in the serverState
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/replication/server/ReplicationServer.java b/opendj-server-legacy/src/main/java/org/opends/server/replication/server/ReplicationServer.java
index d11d16b..cc76193 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/replication/server/ReplicationServer.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/replication/server/ReplicationServer.java
@@ -560,7 +560,7 @@
// create a rule and register it into the DirectoryServer
provider.initializeVirtualAttributeProvider(null);
- AttributeType attributeType = DirectoryServer.getAttributeType(attrName);
+ AttributeType attributeType = DirectoryServer.getAttributeTypeOrNull(attrName);
return new VirtualAttributeRule(attributeType, provider,
baseDNs, SearchScope.BASE_OBJECT,
groupDNs, filters, conflictBehavior);
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 97543f8..3f9d18c 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
@@ -649,8 +649,7 @@
toLowerCase(attributeName, lowerName, true);
String attributeNameString = attributeName.toString();
AttributeType attrType = getAttributeType(lowerName.toString(), attributeNameString);
- rdnComponents.add(
- new RDN(attrType, attributeNameString, ByteString.empty()));
+ rdnComponents.add(new RDN(attrType, attributeNameString, ByteString.empty()));
return new DN(rdnComponents);
}
@@ -663,8 +662,7 @@
// Create the new RDN with the provided information.
StringBuilder lowerName = new StringBuilder();
toLowerCase(attributeName, lowerName, true);
- AttributeType attrType =
- DirectoryServer.getAttributeType(lowerName.toString());
+ AttributeType attrType = DirectoryServer.getAttributeTypeOrNull(lowerName.toString());
String attributeNameString = attributeName.toString();
if (attrType == null)
{
@@ -781,8 +779,7 @@
{
lowerName = new StringBuilder();
toLowerCase(attributeName, lowerName, true);
- attrType =
- DirectoryServer.getAttributeType(lowerName.toString());
+ attrType = DirectoryServer.getAttributeTypeOrNull(lowerName.toString());
attributeNameString = attributeName.toString();
if (attrType == null)
@@ -809,8 +806,7 @@
lowerName = new StringBuilder();
toLowerCase(attributeName, lowerName, true);
- attrType =
- DirectoryServer.getAttributeType(lowerName.toString());
+ attrType = DirectoryServer.getAttributeTypeOrNull(lowerName.toString());
attributeNameString = attributeName.toString();
if (attrType == null)
{
@@ -1109,7 +1105,7 @@
{
name = attributeName.toString();
lowerName = toLowerCase(name);
- attrType = DirectoryServer.getAttributeType(lowerName);
+ attrType = DirectoryServer.getAttributeTypeOrNull(lowerName);
if (attrType == null)
{
@@ -1135,7 +1131,7 @@
// Create the new RDN with the provided information.
name = attributeName.toString();
lowerName = toLowerCase(name);
- attrType = DirectoryServer.getAttributeType(lowerName);
+ attrType = DirectoryServer.getAttributeTypeOrNull(lowerName);
if (attrType == null)
{
// This must be an attribute type that we don't know about.
@@ -1190,7 +1186,7 @@
private static AttributeType getAttributeType(String lowerName, String name)
{
- AttributeType attrType = DirectoryServer.getAttributeType(lowerName);
+ AttributeType attrType = DirectoryServer.getAttributeTypeOrNull(lowerName);
if (attrType == null)
{
// This must be an attribute type that we don't know about.
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 7c5be16..43221fa 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
@@ -2640,16 +2640,14 @@
}
- AttributeType attrType = DirectoryServer.getAttributeType(attrTypeName);
+ AttributeType attrType = DirectoryServer.getAttributeTypeOrNull(attrTypeName);
if (attrType == null)
{
// This should not happen
// The server doesn't have this attribute type defined.
if (logger.isTraceEnabled())
{
- logger.trace(
- "No %s attribute type is defined in the server schema.",
- attrTypeName);
+ logger.trace("No %s attribute type is defined in the server schema.", attrTypeName);
}
return false;
}
@@ -2688,18 +2686,11 @@
*/
public Set<String> getReferralURLs()
{
- AttributeType referralType =
- DirectoryServer.getAttributeType(ATTR_REFERRAL_URL);
+ AttributeType referralType = DirectoryServer.getAttributeTypeOrNull(ATTR_REFERRAL_URL);
if (referralType == null)
{
- // This should not happen -- The server doesn't have a ref
- // attribute type defined.
- if (logger.isTraceEnabled())
- {
- logger.trace(
- "No %s attribute type is defined in the server schema.",
- ATTR_REFERRAL_URL);
- }
+ // This should not happen -- The server doesn't have a ref attribute type defined.
+ logger.trace("No %s attribute type is defined in the server schema.", ATTR_REFERRAL_URL);
return null;
}
@@ -2756,18 +2747,11 @@
*/
public DN getAliasedDN() throws DirectoryException
{
- AttributeType aliasType =
- DirectoryServer.getAttributeType(ATTR_REFERRAL_URL);
+ AttributeType aliasType = DirectoryServer.getAttributeTypeOrNull(ATTR_REFERRAL_URL);
if (aliasType == null)
{
- // This should not happen -- The server doesn't have an
- // aliasedObjectName attribute type defined.
- if (logger.isTraceEnabled())
- {
- logger.trace(
- "No %s attribute type is defined in the server schema.",
- ATTR_ALIAS_DN);
- }
+ // This should not happen -- The server doesn't have an aliasedObjectName attribute type defined.
+ logger.trace("No %s attribute type is defined in the server schema.", ATTR_ALIAS_DN);
return null;
}
@@ -2987,10 +2971,8 @@
}
// Get collective attribute exclusions.
- AttributeType exclusionsType = DirectoryServer.getAttributeType(
- ATTR_COLLECTIVE_EXCLUSIONS_LC);
- List<Attribute> exclusionsAttrList =
- operationalAttributes.get(exclusionsType);
+ AttributeType exclusionsType = DirectoryServer.getAttributeTypeOrNull(ATTR_COLLECTIVE_EXCLUSIONS_LC);
+ List<Attribute> exclusionsAttrList = operationalAttributes.get(exclusionsType);
Set<String> exclusionsNameSet = new HashSet<>();
if (exclusionsAttrList != null && !exclusionsAttrList.isEmpty())
{
@@ -4685,7 +4667,7 @@
options = null;
}
- AttributeType attrType = DirectoryServer.getAttributeType(lowerName);
+ AttributeType attrType = DirectoryServer.getAttributeTypeOrNull(lowerName);
if (attrType == null)
{
// Unrecognized attribute type - do best effort search.
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 548bdbf..7bd24ef 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
@@ -666,7 +666,7 @@
// don't return it yet because this could be a multi-valued RDN.
String name = attributeName.toString();
String lowerName = toLowerCase(name);
- AttributeType attrType = DirectoryServer.getAttributeType(lowerName);
+ AttributeType attrType = DirectoryServer.getAttributeTypeOrNull(lowerName);
if (attrType == null)
{
// This must be an attribute type that we don't know about.
@@ -785,7 +785,7 @@
{
name = attributeName.toString();
lowerName = toLowerCase(name);
- attrType = DirectoryServer.getAttributeType(lowerName);
+ attrType = DirectoryServer.getAttributeTypeOrNull(lowerName);
if (attrType == null)
{
@@ -810,7 +810,7 @@
// Update the RDN to include the new attribute/value.
name = attributeName.toString();
lowerName = toLowerCase(name);
- attrType = DirectoryServer.getAttributeType(lowerName);
+ attrType = DirectoryServer.getAttributeTypeOrNull(lowerName);
if (attrType == null)
{
// This must be an attribute type that we don't know about.
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/types/SearchFilter.java b/opendj-server-legacy/src/main/java/org/opends/server/types/SearchFilter.java
index e2bd714..05fdec5 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/types/SearchFilter.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/types/SearchFilter.java
@@ -2055,7 +2055,7 @@
private static AttributeType getAttributeType(String attrType, StringBuilder lowerType)
{
- AttributeType attributeType = DirectoryServer.getAttributeType(lowerType.toString());
+ AttributeType attributeType = DirectoryServer.getAttributeTypeOrNull(lowerType.toString());
if (attributeType == null)
{
String typeStr = attrType.substring(0, lowerType.length());
diff --git a/opendj-server-legacy/src/test/java/org/forgerock/opendj/adapter/server3x/ConvertersTestCase.java b/opendj-server-legacy/src/test/java/org/forgerock/opendj/adapter/server3x/ConvertersTestCase.java
index 28c6da8..bc4424f 100644
--- a/opendj-server-legacy/src/test/java/org/forgerock/opendj/adapter/server3x/ConvertersTestCase.java
+++ b/opendj-server-legacy/src/test/java/org/forgerock/opendj/adapter/server3x/ConvertersTestCase.java
@@ -436,7 +436,7 @@
byte[] data = { 0x00, 0x01, 0x02, (byte) 0xff };
ByteString attrValue = ByteString.wrap(data);
- Attribute attribute = Attributes.create(DirectoryServer.getAttributeType("cn"), attrValue);
+ Attribute attribute = Attributes.create(DirectoryServer.getAttributeTypeOrNull("cn"), attrValue);
assertThat(from(attribute).firstValue().toByteArray()).isEqualTo(data);
}
diff --git a/opendj-server-legacy/src/test/java/org/opends/server/admin/AttributeTypePropertyDefinitionTest.java b/opendj-server-legacy/src/test/java/org/opends/server/admin/AttributeTypePropertyDefinitionTest.java
index 82bf43c..34d9d41 100644
--- a/opendj-server-legacy/src/test/java/org/opends/server/admin/AttributeTypePropertyDefinitionTest.java
+++ b/opendj-server-legacy/src/test/java/org/opends/server/admin/AttributeTypePropertyDefinitionTest.java
@@ -64,7 +64,7 @@
public void testValidateValue() {
AttributeTypePropertyDefinition.setCheckSchema(true);
AttributeTypePropertyDefinition d = createPropertyDefinition();
- d.validateValue(DirectoryServer.getAttributeType("cn"));
+ d.validateValue(DirectoryServer.getAttributeTypeOrNull("cn"));
}
@@ -89,7 +89,7 @@
public void testDecodeValue(String value) {
AttributeTypePropertyDefinition.setCheckSchema(true);
AttributeTypePropertyDefinition d = createPropertyDefinition();
- AttributeType expected = DirectoryServer.getAttributeType(value);
+ AttributeType expected = DirectoryServer.getAttributeTypeOrNull(value);
assertEquals(d.decodeValue(value), expected);
}
diff --git a/opendj-server-legacy/src/test/java/org/opends/server/admin/client/ldap/AggregationClientTest.java b/opendj-server-legacy/src/test/java/org/opends/server/admin/client/ldap/AggregationClientTest.java
index 71f815c..6df2bde 100644
--- a/opendj-server-legacy/src/test/java/org/opends/server/admin/client/ldap/AggregationClientTest.java
+++ b/opendj-server-legacy/src/test/java/org/opends/server/admin/client/ldap/AggregationClientTest.java
@@ -315,13 +315,10 @@
ManagementContext ctx = LDAPManagementContext.createFromContext(c);
TestParentCfgClient parent = getTestParent(ctx, "test parent 1");
- TestChildCfgClient child = parent.createTestChild(TestChildCfgDefn
- .getInstance(), "test child new", null);
+ TestChildCfgClient child = parent.createTestChild(TestChildCfgDefn.getInstance(), "test child new", null);
child.setMandatoryBooleanProperty(true);
- child.setMandatoryReadOnlyAttributeTypeProperty(DirectoryServer
- .getAttributeType("description"));
- child.setAggregationProperty(Collections
- .singleton("LDAP Connection Handler"));
+ child.setMandatoryReadOnlyAttributeTypeProperty(DirectoryServer.getAttributeTypeOrNull("description"));
+ child.setAggregationProperty(Collections.singleton("LDAP Connection Handler"));
child.commit();
c.assertEntryIsCreated();
diff --git a/opendj-server-legacy/src/test/java/org/opends/server/admin/client/ldap/LDAPClientTest.java b/opendj-server-legacy/src/test/java/org/opends/server/admin/client/ldap/LDAPClientTest.java
index aea4cc1..75ccb36 100644
--- a/opendj-server-legacy/src/test/java/org/opends/server/admin/client/ldap/LDAPClientTest.java
+++ b/opendj-server-legacy/src/test/java/org/opends/server/admin/client/ldap/LDAPClientTest.java
@@ -306,11 +306,9 @@
ManagementContext ctx = LDAPManagementContext.createFromContext(c);
TestParentCfgClient parent = getTestParent(ctx, "test parent 1");
- TestChildCfgClient child = parent.createTestChild(TestChildCfgDefn
- .getInstance(), "test child new", null);
+ TestChildCfgClient child = parent.createTestChild(TestChildCfgDefn.getInstance(), "test child new", null);
child.setMandatoryBooleanProperty(true);
- child.setMandatoryReadOnlyAttributeTypeProperty(DirectoryServer
- .getAttributeType("description"));
+ child.setMandatoryReadOnlyAttributeTypeProperty(DirectoryServer.getAttributeTypeOrNull("description"));
child.commit();
c.assertEntryIsCreated();
@@ -331,22 +329,17 @@
public void testCreateManagedObjectException(final NamingException cause,
Class<? extends Exception> expected) {
MockLDAPConnection c = new MockLDAPConnection() {
-
- /** {@inheritDoc} */
@Override
- public void createEntry(LdapName dn, Attributes attributes)
- throws NamingException {
+ public void createEntry(LdapName dn, Attributes attributes) throws NamingException {
throw cause;
}
-
};
c.importLDIF(TEST_LDIF);
ManagementContext ctx = LDAPManagementContext.createFromContext(c);
try {
TestParentCfgClient parent = createTestParent(ctx, "test parent new");
parent.setMandatoryBooleanProperty(true);
- parent.setMandatoryReadOnlyAttributeTypeProperty(DirectoryServer
- .getAttributeType("description"));
+ parent.setMandatoryReadOnlyAttributeTypeProperty(DirectoryServer.getAttributeTypeOrNull("description"));
parent.commit();
} catch (Exception e) {
Assert.assertEquals(e.getClass(), expected);
@@ -376,8 +369,7 @@
ManagementContext ctx = LDAPManagementContext.createFromContext(c);
TestParentCfgClient parent = createTestParent(ctx, "test parent new");
parent.setMandatoryBooleanProperty(true);
- parent.setMandatoryReadOnlyAttributeTypeProperty(DirectoryServer
- .getAttributeType("description"));
+ parent.setMandatoryReadOnlyAttributeTypeProperty(DirectoryServer.getAttributeTypeOrNull("description"));
parent.commit();
c.assertEntryIsCreated();
}
@@ -402,7 +394,7 @@
Assert.assertEquals(child.getMandatoryClassProperty(),
"org.opends.server.extensions.UserDefinedVirtualAttributeProvider");
Assert.assertEquals(child.getMandatoryReadOnlyAttributeTypeProperty(),
- DirectoryServer.getAttributeType("description"));
+ DirectoryServer.getAttributeTypeOrNull("description"));
assertDNSetEquals(child.getOptionalMultiValuedDNProperty1(),
"dc=default value c3v1,dc=com", "dc=default value c3v2,dc=com");
assertDNSetEquals(child.getOptionalMultiValuedDNProperty2(),
@@ -428,7 +420,7 @@
Assert.assertEquals(child.getMandatoryClassProperty(),
"org.opends.server.extensions.UserDefinedVirtualAttributeProvider");
Assert.assertEquals(child.getMandatoryReadOnlyAttributeTypeProperty(),
- DirectoryServer.getAttributeType("description"));
+ DirectoryServer.getAttributeTypeOrNull("description"));
assertDNSetEquals(child.getOptionalMultiValuedDNProperty1(),
"dc=domain1,dc=com", "dc=domain2,dc=com", "dc=domain3,dc=com");
assertDNSetEquals(child.getOptionalMultiValuedDNProperty2(),
@@ -488,7 +480,7 @@
Assert.assertEquals(parent.getMandatoryClassProperty(),
"org.opends.server.extensions.UserDefinedVirtualAttributeProvider");
Assert.assertEquals(parent.getMandatoryReadOnlyAttributeTypeProperty(),
- DirectoryServer.getAttributeType("description"));
+ DirectoryServer.getAttributeTypeOrNull("description"));
assertDNSetEquals(parent.getOptionalMultiValuedDNProperty(),
"dc=default value p2v1,dc=com", "dc=default value p2v2,dc=com");
}
@@ -512,7 +504,7 @@
Assert.assertEquals(parent.getMandatoryClassProperty(),
"org.opends.server.extensions.UserDefinedVirtualAttributeProvider");
Assert.assertEquals(parent.getMandatoryReadOnlyAttributeTypeProperty(),
- DirectoryServer.getAttributeType("description"));
+ DirectoryServer.getAttributeTypeOrNull("description"));
assertDNSetEquals(parent.getOptionalMultiValuedDNProperty(),
"dc=domain1,dc=com", "dc=domain2,dc=com", "dc=domain3,dc=com");
}
@@ -554,8 +546,7 @@
// Check that the default values are not committed.
child.setMandatoryBooleanProperty(true);
- child.setMandatoryReadOnlyAttributeTypeProperty(DirectoryServer
- .getAttributeType("description"));
+ child.setMandatoryReadOnlyAttributeTypeProperty(DirectoryServer.getAttributeTypeOrNull("description"));
child.commit();
c.assertEntryIsCreated();
@@ -598,8 +589,7 @@
// Check that the default values are not committed.
child.setMandatoryBooleanProperty(true);
- child.setMandatoryReadOnlyAttributeTypeProperty(DirectoryServer
- .getAttributeType("description"));
+ child.setMandatoryReadOnlyAttributeTypeProperty(DirectoryServer.getAttributeTypeOrNull("description"));
child.commit();
c.assertEntryIsCreated();
@@ -815,11 +805,9 @@
ManagementContext ctx = LDAPManagementContext.createFromContext(c);
TestParentCfgClient parent = getTestParent(ctx, "test parent 1");
- TestChildCfgClient child = parent.createTestChild(TestChildCfgDefn
- .getInstance(), "test child new", null);
+ TestChildCfgClient child = parent.createTestChild(TestChildCfgDefn.getInstance(), "test child new", null);
child.setMandatoryBooleanProperty(true);
- child.setMandatoryReadOnlyAttributeTypeProperty(DirectoryServer
- .getAttributeType("description"));
+ child.setMandatoryReadOnlyAttributeTypeProperty(DirectoryServer.getAttributeTypeOrNull("description"));
child.commit();
c.assertEntryIsCreated();
@@ -856,11 +844,9 @@
ManagementContext ctx = LDAPManagementContext.createFromContext(c);
TestParentCfgClient parent = getTestParent(ctx, "test parent 1");
- TestChildCfgClient child = parent.createTestChild(TestChildCfgDefn
- .getInstance(), "test child new", null);
+ TestChildCfgClient child = parent.createTestChild(TestChildCfgDefn.getInstance(), "test child new", null);
child.setMandatoryBooleanProperty(true);
- child.setMandatoryReadOnlyAttributeTypeProperty(DirectoryServer
- .getAttributeType("description"));
+ child.setMandatoryReadOnlyAttributeTypeProperty(DirectoryServer.getAttributeTypeOrNull("description"));
child.commit();
Assert.fail("The add constraint failed to prevent creation of the managed object");
} finally {
diff --git a/opendj-server-legacy/src/test/java/org/opends/server/admin/server/AggregationServerTest.java b/opendj-server-legacy/src/test/java/org/opends/server/admin/server/AggregationServerTest.java
index 2cbfc7d..dea5bdb 100644
--- a/opendj-server-legacy/src/test/java/org/opends/server/admin/server/AggregationServerTest.java
+++ b/opendj-server-legacy/src/test/java/org/opends/server/admin/server/AggregationServerTest.java
@@ -873,7 +873,7 @@
Assert.assertEquals(child.getMandatoryClassProperty(),
"org.opends.server.extensions.UserDefinedVirtualAttributeProvider");
Assert.assertEquals(child.getMandatoryReadOnlyAttributeTypeProperty(),
- DirectoryServer.getAttributeType("description"));
+ DirectoryServer.getAttributeTypeOrNull("description"));
assertSetEquals(child.getAggregationProperty(), new String[0]);
}
@@ -884,7 +884,7 @@
Assert.assertEquals(child.getMandatoryClassProperty(),
"org.opends.server.extensions.UserDefinedVirtualAttributeProvider");
Assert.assertEquals(child.getMandatoryReadOnlyAttributeTypeProperty(),
- DirectoryServer.getAttributeType("description"));
+ DirectoryServer.getAttributeTypeOrNull("description"));
// Test normalization.
assertSetEquals(child.getAggregationProperty(), "LDAP Connection Handler");
@@ -901,7 +901,7 @@
Assert.assertEquals(child.getMandatoryClassProperty(),
"org.opends.server.extensions.UserDefinedVirtualAttributeProvider");
Assert.assertEquals(child.getMandatoryReadOnlyAttributeTypeProperty(),
- DirectoryServer.getAttributeType("description"));
+ DirectoryServer.getAttributeTypeOrNull("description"));
assertSetEquals(child.getAggregationProperty(), "LDAPS Connection Handler",
"LDAP Connection Handler");
}
diff --git a/opendj-server-legacy/src/test/java/org/opends/server/admin/server/DefaultBehaviorTest.java b/opendj-server-legacy/src/test/java/org/opends/server/admin/server/DefaultBehaviorTest.java
index 3165bf4..1eef1fc 100644
--- a/opendj-server-legacy/src/test/java/org/opends/server/admin/server/DefaultBehaviorTest.java
+++ b/opendj-server-legacy/src/test/java/org/opends/server/admin/server/DefaultBehaviorTest.java
@@ -450,7 +450,7 @@
Assert.assertEquals(child.getMandatoryClassProperty(),
"org.opends.server.extensions.UserDefinedVirtualAttributeProvider");
Assert.assertEquals(child.getMandatoryReadOnlyAttributeTypeProperty(),
- DirectoryServer.getAttributeType("description"));
+ DirectoryServer.getAttributeTypeOrNull("description"));
assertDNSetEquals(child.getOptionalMultiValuedDNProperty1(),
"dc=new value 1,dc=com", "dc=new value 2,dc=com");
assertDNSetEquals(child.getOptionalMultiValuedDNProperty2(),
@@ -499,7 +499,7 @@
Assert.assertEquals(child.getMandatoryClassProperty(),
"org.opends.server.extensions.UserDefinedVirtualAttributeProvider");
Assert.assertEquals(child.getMandatoryReadOnlyAttributeTypeProperty(),
- DirectoryServer.getAttributeType("description"));
+ DirectoryServer.getAttributeTypeOrNull("description"));
assertDNSetEquals(child.getOptionalMultiValuedDNProperty1(),
"dc=new value 1,dc=com", "dc=new value 2,dc=com");
assertDNSetEquals(child.getOptionalMultiValuedDNProperty2(),
@@ -547,7 +547,7 @@
Assert.assertEquals(child.getMandatoryClassProperty(),
"org.opends.server.extensions.UserDefinedVirtualAttributeProvider");
Assert.assertEquals(child.getMandatoryReadOnlyAttributeTypeProperty(),
- DirectoryServer.getAttributeType("description"));
+ DirectoryServer.getAttributeTypeOrNull("description"));
assertDNSetEquals(child.getOptionalMultiValuedDNProperty1(),
"dc=domain1,dc=com", "dc=domain2,dc=com", "dc=domain3,dc=com");
assertDNSetEquals(child.getOptionalMultiValuedDNProperty2(),
@@ -596,7 +596,7 @@
Assert.assertEquals(child.getMandatoryClassProperty(),
"org.opends.server.extensions.UserDefinedVirtualAttributeProvider");
Assert.assertEquals(child.getMandatoryReadOnlyAttributeTypeProperty(),
- DirectoryServer.getAttributeType("description"));
+ DirectoryServer.getAttributeTypeOrNull("description"));
assertDNSetEquals(child.getOptionalMultiValuedDNProperty1(),
"dc=new value 1,dc=com", "dc=new value 2,dc=com");
assertDNSetEquals(child.getOptionalMultiValuedDNProperty2(),
@@ -713,7 +713,7 @@
Assert.assertEquals(parent.getMandatoryClassProperty(),
"org.opends.server.extensions.UserDefinedVirtualAttributeProvider");
Assert.assertEquals(parent.getMandatoryReadOnlyAttributeTypeProperty(),
- DirectoryServer.getAttributeType("description"));
+ DirectoryServer.getAttributeTypeOrNull("description"));
assertDNSetEquals(parent.getOptionalMultiValuedDNProperty(),
"dc=domain1,dc=com", "dc=domain2,dc=com", "dc=domain3,dc=com");
}
@@ -733,7 +733,7 @@
Assert.assertEquals(parent.getMandatoryClassProperty(),
"org.opends.server.extensions.UserDefinedVirtualAttributeProvider");
Assert.assertEquals(parent.getMandatoryReadOnlyAttributeTypeProperty(),
- DirectoryServer.getAttributeType("description"));
+ DirectoryServer.getAttributeTypeOrNull("description"));
assertDNSetEquals(parent.getOptionalMultiValuedDNProperty(),
"dc=default value p2v1,dc=com", "dc=default value p2v2,dc=com");
}
@@ -745,7 +745,7 @@
Assert.assertEquals(child.getMandatoryClassProperty(),
"org.opends.server.extensions.UserDefinedVirtualAttributeProvider");
Assert.assertEquals(child.getMandatoryReadOnlyAttributeTypeProperty(),
- DirectoryServer.getAttributeType("description"));
+ DirectoryServer.getAttributeTypeOrNull("description"));
assertDNSetEquals(child.getOptionalMultiValuedDNProperty1(),
"dc=domain1,dc=com", "dc=domain2,dc=com", "dc=domain3,dc=com");
assertDNSetEquals(child.getOptionalMultiValuedDNProperty2(),
@@ -759,7 +759,7 @@
Assert.assertEquals(child.getMandatoryClassProperty(),
"org.opends.server.extensions.UserDefinedVirtualAttributeProvider");
Assert.assertEquals(child.getMandatoryReadOnlyAttributeTypeProperty(),
- DirectoryServer.getAttributeType("description"));
+ DirectoryServer.getAttributeTypeOrNull("description"));
assertDNSetEquals(child.getOptionalMultiValuedDNProperty1(),
"dc=default value c2v1,dc=com", "dc=default value c2v2,dc=com");
assertDNSetEquals(child.getOptionalMultiValuedDNProperty2(),
@@ -773,7 +773,7 @@
Assert.assertEquals(child.getMandatoryClassProperty(),
"org.opends.server.extensions.UserDefinedVirtualAttributeProvider");
Assert.assertEquals(child.getMandatoryReadOnlyAttributeTypeProperty(),
- DirectoryServer.getAttributeType("description"));
+ DirectoryServer.getAttributeTypeOrNull("description"));
assertDNSetEquals(child.getOptionalMultiValuedDNProperty1(),
"dc=default value c3v1,dc=com", "dc=default value c3v2,dc=com");
assertDNSetEquals(child.getOptionalMultiValuedDNProperty2(),
@@ -787,7 +787,7 @@
Assert.assertEquals(child.getMandatoryClassProperty(),
"org.opends.server.extensions.UserDefinedVirtualAttributeProvider");
Assert.assertEquals(child.getMandatoryReadOnlyAttributeTypeProperty(),
- DirectoryServer.getAttributeType("description"));
+ DirectoryServer.getAttributeTypeOrNull("description"));
assertDNSetEquals(child.getOptionalMultiValuedDNProperty1(),
"dc=default value p2v1,dc=com", "dc=default value p2v2,dc=com");
assertDNSetEquals(child.getOptionalMultiValuedDNProperty2(),
diff --git a/opendj-server-legacy/src/test/java/org/opends/server/backends/SchemaBackendTestCase.java b/opendj-server-legacy/src/test/java/org/opends/server/backends/SchemaBackendTestCase.java
index 6f61778..a69915c 100644
--- a/opendj-server-legacy/src/test/java/org/opends/server/backends/SchemaBackendTestCase.java
+++ b/opendj-server-legacy/src/test/java/org/opends/server/backends/SchemaBackendTestCase.java
@@ -110,16 +110,16 @@
assertNotNull(schemaEntry);
assertEquals(schemaEntry.getName(), schemaDN);
- AttributeType t = DirectoryServer.getAttributeType("attributetypes");
+ AttributeType t = DirectoryServer.getAttributeTypeOrNull("attributetypes");
assertTrue(schemaEntry.hasAttribute(t));
- t = DirectoryServer.getAttributeType("objectclasses");
+ t = DirectoryServer.getAttributeTypeOrNull("objectclasses");
assertTrue(schemaEntry.hasAttribute(t));
- t = DirectoryServer.getAttributeType("ldapsyntaxes");
+ t = DirectoryServer.getAttributeTypeOrNull("ldapsyntaxes");
assertTrue(schemaEntry.hasAttribute(t));
- t = DirectoryServer.getAttributeType("matchingrules");
+ t = DirectoryServer.getAttributeTypeOrNull("matchingrules");
assertTrue(schemaEntry.hasAttribute(t));
}
@@ -161,16 +161,16 @@
assertNotNull(schemaEntry);
assertEquals(schemaEntry.getName(), schemaDN);
- AttributeType t = DirectoryServer.getAttributeType("attributetypes");
+ AttributeType t = DirectoryServer.getAttributeTypeOrNull("attributetypes");
assertTrue(schemaEntry.hasAttribute(t));
- t = DirectoryServer.getAttributeType("objectclasses");
+ t = DirectoryServer.getAttributeTypeOrNull("objectclasses");
assertTrue(schemaEntry.hasAttribute(t));
- t = DirectoryServer.getAttributeType("ldapsyntaxes");
+ t = DirectoryServer.getAttributeTypeOrNull("ldapsyntaxes");
assertTrue(schemaEntry.hasAttribute(t));
- t = DirectoryServer.getAttributeType("matchingrules");
+ t = DirectoryServer.getAttributeTypeOrNull("matchingrules");
assertTrue(schemaEntry.hasAttribute(t));
@@ -179,16 +179,16 @@
assertNotNull(schemaEntry);
assertEquals(schemaEntry.getName(), schemaDN);
- t = DirectoryServer.getAttributeType("attributetypes");
+ t = DirectoryServer.getAttributeTypeOrNull("attributetypes");
assertTrue(schemaEntry.hasAttribute(t));
- t = DirectoryServer.getAttributeType("objectclasses");
+ t = DirectoryServer.getAttributeTypeOrNull("objectclasses");
assertTrue(schemaEntry.hasAttribute(t));
- t = DirectoryServer.getAttributeType("ldapsyntaxes");
+ t = DirectoryServer.getAttributeTypeOrNull("ldapsyntaxes");
assertTrue(schemaEntry.hasAttribute(t));
- t = DirectoryServer.getAttributeType("matchingrules");
+ t = DirectoryServer.getAttributeTypeOrNull("matchingrules");
assertTrue(schemaEntry.hasAttribute(t));
}
@@ -400,10 +400,10 @@
throws Exception
{
DN schemaDN = DN.valueOf("cn=schema");
- AttributeType a = DirectoryServer.getAttributeType("attributetypes");
- AttributeType o = DirectoryServer.getAttributeType("objectclasses");
- AttributeType m = DirectoryServer.getAttributeType("matchingrules");
- AttributeType s = DirectoryServer.getAttributeType("ldapsyntaxes");
+ AttributeType a = DirectoryServer.getAttributeTypeOrNull("attributetypes");
+ AttributeType o = DirectoryServer.getAttributeTypeOrNull("objectclasses");
+ AttributeType m = DirectoryServer.getAttributeTypeOrNull("matchingrules");
+ AttributeType s = DirectoryServer.getAttributeTypeOrNull("ldapsyntaxes");
assertFalse(schemaBackend.showAllAttributes());
Entry schemaEntry = schemaBackend.getSchemaEntry(schemaDN, false);
diff --git a/opendj-server-legacy/src/test/java/org/opends/server/backends/jeb/TestBackendImpl.java b/opendj-server-legacy/src/test/java/org/opends/server/backends/jeb/TestBackendImpl.java
index dbbda89..8c21ee3 100644
--- a/opendj-server-legacy/src/test/java/org/opends/server/backends/jeb/TestBackendImpl.java
+++ b/opendj-server-legacy/src/test/java/org/opends/server/backends/jeb/TestBackendImpl.java
@@ -570,9 +570,9 @@
"ou: People"
);
- givenName = DirectoryServer.getAttributeType("givenname");
- title = DirectoryServer.getAttributeType("title");
- name = DirectoryServer.getAttributeType("name");
+ givenName = DirectoryServer.getAttributeTypeOrNull("givenname");
+ title = DirectoryServer.getAttributeTypeOrNull("title");
+ name = DirectoryServer.getAttributeTypeOrNull("name");
}
@AfterClass
@@ -1268,7 +1268,7 @@
assertEquals(resultCode, 0);
- AttributeType givennameAttr = DirectoryServer.getAttributeType("givenname");
+ AttributeType givennameAttr = DirectoryServer.getAttributeTypeOrNull("givenname");
assertNull(ec.getAttributeIndex(givennameAttr));
List<DatabaseContainer> databases = new ArrayList<>();
diff --git a/opendj-server-legacy/src/test/java/org/opends/server/backends/jeb/TestImportJob.java b/opendj-server-legacy/src/test/java/org/opends/server/backends/jeb/TestImportJob.java
index d3e87bb..62c3c70 100644
--- a/opendj-server-legacy/src/test/java/org/opends/server/backends/jeb/TestImportJob.java
+++ b/opendj-server-legacy/src/test/java/org/opends/server/backends/jeb/TestImportJob.java
@@ -471,7 +471,7 @@
Entry entry = entryContainer.getEntry(DN.valueOf("uid=user.446,dc=importtest1,dc=com"));
assertNotNull(entry);
- AttributeType attrType = DirectoryServer.getAttributeType("cn");
+ AttributeType attrType = DirectoryServer.getAttributeTypeOrNull("cn");
assertTrue(entry.hasValue(attrType, null, ByteString.valueOf("Annalee Bogard")));
assertEquals(verifyBackend(importtest1DN), 0);
diff --git a/opendj-server-legacy/src/test/java/org/opends/server/backends/jeb/TestVLVIndex.java b/opendj-server-legacy/src/test/java/org/opends/server/backends/jeb/TestVLVIndex.java
index d18ef03..f573d8a 100644
--- a/opendj-server-legacy/src/test/java/org/opends/server/backends/jeb/TestVLVIndex.java
+++ b/opendj-server-legacy/src/test/java/org/opends/server/backends/jeb/TestVLVIndex.java
@@ -94,12 +94,11 @@
TestCaseUtils.startServer();
TestCaseUtils.enableBackend(beID);
- SortKey[] sortKeys = new SortKey[3];
- sortKeys[0] = new SortKey(DirectoryServer.getAttributeType("givenname"), true);
- sortKeys[1] = new SortKey(DirectoryServer.getAttributeType("sn"),
- false);
- sortKeys[2] = new SortKey(
- DirectoryServer.getAttributeType("uid"), true);
+ SortKey[] sortKeys = new SortKey[] {
+ new SortKey(DirectoryServer.getAttributeTypeOrNull("givenname"), true),
+ new SortKey(DirectoryServer.getAttributeTypeOrNull("sn"), false),
+ new SortKey(DirectoryServer.getAttributeTypeOrNull("uid"), true),
+ };
sortOrder = new SortOrder(sortKeys);
aaccfJohnsonDN = DN.valueOf("uid=aaccf.johnson,dc=vlvtest,dc=com");
diff --git a/opendj-server-legacy/src/test/java/org/opends/server/backends/jeb/TestVerifyJob.java b/opendj-server-legacy/src/test/java/org/opends/server/backends/jeb/TestVerifyJob.java
index 789242e..1d25299 100644
--- a/opendj-server-legacy/src/test/java/org/opends/server/backends/jeb/TestVerifyJob.java
+++ b/opendj-server-legacy/src/test/java/org/opends/server/backends/jeb/TestVerifyJob.java
@@ -350,7 +350,7 @@
eContainer.sharedLock.lock();
try
{
- AttributeType attributeType = DirectoryServer.getAttributeType(phoneType);
+ AttributeType attributeType = DirectoryServer.getAttributeTypeOrNull(phoneType);
Index index = eContainer.getAttributeIndex(attributeType).getIndex(EQUALITY_TELEPHONE);
//Add entry with bad JEB format Version
addID2EntryReturnKey(junkDN, 4, true);
@@ -639,8 +639,7 @@
eContainer.sharedLock.lock();
try
{
- AttributeType attributeType =
- DirectoryServer.getAttributeType(mailType);
+ AttributeType attributeType = DirectoryServer.getAttributeTypeOrNull(mailType);
//Get db handles to each index.
AttributeIndex attributeIndex = eContainer.getAttributeIndex(attributeType);
Index eqIndex = attributeIndex.getIndex(EQUALITY_CASE_IGNORE);
diff --git a/opendj-server-legacy/src/test/java/org/opends/server/backends/pluggable/DN2IDTest.java b/opendj-server-legacy/src/test/java/org/opends/server/backends/pluggable/DN2IDTest.java
index e69964d..0e56e9a 100644
--- a/opendj-server-legacy/src/test/java/org/opends/server/backends/pluggable/DN2IDTest.java
+++ b/opendj-server-legacy/src/test/java/org/opends/server/backends/pluggable/DN2IDTest.java
@@ -332,7 +332,7 @@
BackendIndexCfg indexCfg = legacyMockCfg(BackendIndexCfg.class);
when(indexCfg.getIndexType()).thenReturn(newTreeSet(IndexType.PRESENCE, IndexType.EQUALITY));
- when(indexCfg.getAttribute()).thenReturn(DirectoryServer.getAttributeType("sn"));
+ when(indexCfg.getAttribute()).thenReturn(DirectoryServer.getAttributeTypeOrNull("sn"));
when(backendCfg.getBackendIndex("sn")).thenReturn(indexCfg);
return backendCfg;
diff --git a/opendj-server-legacy/src/test/java/org/opends/server/backends/pluggable/ID2CountTest.java b/opendj-server-legacy/src/test/java/org/opends/server/backends/pluggable/ID2CountTest.java
index 18c5812..b15eee9 100644
--- a/opendj-server-legacy/src/test/java/org/opends/server/backends/pluggable/ID2CountTest.java
+++ b/opendj-server-legacy/src/test/java/org/opends/server/backends/pluggable/ID2CountTest.java
@@ -250,7 +250,7 @@
BackendIndexCfg indexCfg = legacyMockCfg(BackendIndexCfg.class);
when(indexCfg.getIndexType()).thenReturn(newTreeSet(IndexType.PRESENCE, IndexType.EQUALITY));
- when(indexCfg.getAttribute()).thenReturn(DirectoryServer.getAttributeType("sn"));
+ when(indexCfg.getAttribute()).thenReturn(DirectoryServer.getAttributeTypeOrNull("sn"));
when(backendCfg.getBackendIndex("sn")).thenReturn(indexCfg);
return backendCfg;
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 108b7b7..ae9517c 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
@@ -171,7 +171,7 @@
for (Map.Entry<String, IndexType[]> index : backendIndexes.entrySet())
{
final String attributeName = index.getKey().toLowerCase();
- final AttributeType attribute = DirectoryServer.getAttributeType(attributeName);
+ final AttributeType attribute = DirectoryServer.getAttributeTypeOrNull(attributeName);
Reject.ifNull(attribute, "Attribute type '" + attributeName + "' doesn't exists.");
BackendIndexCfg indexCfg = mock(BackendIndexCfg.class);
@@ -677,7 +677,7 @@
{
for (IndexType type : index.getValue())
{
- final AttributeType attributeType = DirectoryServer.getAttributeType(index.getKey().toLowerCase());
+ final AttributeType attributeType = DirectoryServer.getAttributeTypeOrNull(index.getKey().toLowerCase());
assertTrue(backend.isIndexed(attributeType,
org.opends.server.types.IndexType.valueOf(type.toString().toUpperCase())));
}
@@ -876,7 +876,7 @@
Entry oldEntry = workEntries.get(0);
Entry newEntry = oldEntry.duplicate(false);
- modifyAttribute = DirectoryServer.getAttributeType("jpegphoto");
+ modifyAttribute = DirectoryServer.getAttributeTypeOrNull("jpegphoto");
newEntry.applyModifications(Arrays.asList(new Modification(ADD, create(modifyAttribute, modifyValue))));
backend.replaceEntry(oldEntry, newEntry, null);
diff --git a/opendj-server-legacy/src/test/java/org/opends/server/backends/pluggable/StateTest.java b/opendj-server-legacy/src/test/java/org/opends/server/backends/pluggable/StateTest.java
index 3a44e47..113d25c 100644
--- a/opendj-server-legacy/src/test/java/org/opends/server/backends/pluggable/StateTest.java
+++ b/opendj-server-legacy/src/test/java/org/opends/server/backends/pluggable/StateTest.java
@@ -200,7 +200,7 @@
BackendIndexCfg indexCfg = legacyMockCfg(BackendIndexCfg.class);
when(indexCfg.getIndexType()).thenReturn(newTreeSet(IndexType.PRESENCE, IndexType.EQUALITY));
- when(indexCfg.getAttribute()).thenReturn(DirectoryServer.getAttributeType("sn"));
+ when(indexCfg.getAttribute()).thenReturn(DirectoryServer.getAttributeTypeOrNull("sn"));
when(backendCfg.getBackendIndex("sn")).thenReturn(indexCfg);
return backendCfg;
diff --git a/opendj-server-legacy/src/test/java/org/opends/server/controls/MatchedValuesControlTest.java b/opendj-server-legacy/src/test/java/org/opends/server/controls/MatchedValuesControlTest.java
index 947f4af..48e0028 100644
--- a/opendj-server-legacy/src/test/java/org/opends/server/controls/MatchedValuesControlTest.java
+++ b/opendj-server-legacy/src/test/java/org/opends/server/controls/MatchedValuesControlTest.java
@@ -125,7 +125,7 @@
}
- AttributeType attType = DirectoryServer.getAttributeType(type);
+ AttributeType attType = DirectoryServer.getAttributeTypeOrNull(type);
ByteString attVal = null;
if (attType != null)
{
@@ -204,7 +204,7 @@
// input parameter
String rawAttTypeTest = type;
- AttributeType attTypeTest = DirectoryServer.getAttributeType(type);
+ AttributeType attTypeTest = DirectoryServer.getAttributeTypeOrNull(type);
ByteString subInitialTest = ByteString.valueOf(subInitial);
List<ByteString> subAnyTest = new ArrayList<>(subAny.size());
for (String s : subAny)
@@ -382,7 +382,7 @@
}
// ( AttributeType attributeType, ByteString assertionValue
- AttributeType attType = DirectoryServer.getAttributeType(type);
+ AttributeType attType = DirectoryServer.getAttributeTypeOrNull(type);
ByteString attVal = null;
if (attType != null)
{
@@ -478,7 +478,7 @@
}
- AttributeType attType = DirectoryServer.getAttributeType(type);
+ AttributeType attType = DirectoryServer.getAttributeTypeOrNull(type);
ByteString attVal = null ;
if (attType != null)
{
@@ -554,7 +554,7 @@
assertEquals(mvf.getMatchType(), MatchedValuesFilter.PRESENT_TYPE);
// ( AttributeType attributeType
- AttributeType attType = DirectoryServer.getAttributeType(type);
+ AttributeType attType = DirectoryServer.getAttributeTypeOrNull(type);
try
{
@@ -623,7 +623,7 @@
}
// ( AttributeType attributeType, ByteString assertionValue
- AttributeType attType = DirectoryServer.getAttributeType(type);
+ AttributeType attType = DirectoryServer.getAttributeTypeOrNull(type);
ByteString attVal = null ;
if (attType != null)
{
@@ -704,7 +704,7 @@
// input value
String rawAttTypeTest = type ;
- AttributeType attTypeTest = DirectoryServer.getAttributeType(type) ;
+ AttributeType attTypeTest = DirectoryServer.getAttributeTypeOrNull(type) ;
String matchingRuleIdTest = matchingRule.getOID() ;
ByteString attValueTest = (attTypeTest == null) ? null : ByteString.valueOf(value);
// parameter used for the test.
@@ -814,7 +814,7 @@
public void testDifferentNormalization(String type, ByteString value,
String assertion)
{
- AttributeType attrType = DirectoryServer.getAttributeType("usercertificate");
+ AttributeType attrType = DirectoryServer.getAttributeTypeOrNull("usercertificate");
MatchedValuesFilter mvf = MatchedValuesFilter.createEqualityFilter(type, ByteString.valueOf(assertion));
assertTrue(mvf.valueMatches(attrType, value));
}
diff --git a/opendj-server-legacy/src/test/java/org/opends/server/controls/ServerSideSortControlTestCase.java b/opendj-server-legacy/src/test/java/org/opends/server/controls/ServerSideSortControlTestCase.java
index 7011a16..661f888 100644
--- a/opendj-server-legacy/src/test/java/org/opends/server/controls/ServerSideSortControlTestCase.java
+++ b/opendj-server-legacy/src/test/java/org/opends/server/controls/ServerSideSortControlTestCase.java
@@ -97,10 +97,10 @@
{
TestCaseUtils.startServer();
- givenNameType = DirectoryServer.getAttributeType("givenname");
+ givenNameType = DirectoryServer.getAttributeTypeOrNull("givenname");
assertNotNull(givenNameType);
- snType = DirectoryServer.getAttributeType("sn");
+ snType = DirectoryServer.getAttributeTypeOrNull("sn");
assertNotNull(snType);
aaccfJohnsonDN = DN.valueOf("uid=aaccf.johnson,dc=example,dc=com");
diff --git a/opendj-server-legacy/src/test/java/org/opends/server/controls/VLVControlTestCase.java b/opendj-server-legacy/src/test/java/org/opends/server/controls/VLVControlTestCase.java
index 735a2d0..f82e71b 100644
--- a/opendj-server-legacy/src/test/java/org/opends/server/controls/VLVControlTestCase.java
+++ b/opendj-server-legacy/src/test/java/org/opends/server/controls/VLVControlTestCase.java
@@ -96,10 +96,10 @@
{
TestCaseUtils.startServer();
- givenNameType = DirectoryServer.getAttributeType("givenname");
+ givenNameType = DirectoryServer.getAttributeTypeOrNull("givenname");
assertNotNull(givenNameType);
- snType = DirectoryServer.getAttributeType("sn");
+ snType = DirectoryServer.getAttributeTypeOrNull("sn");
assertNotNull(snType);
aaccfJohnsonDN = DN.valueOf("uid=aaccf.johnson,dc=example,dc=com");
diff --git a/opendj-server-legacy/src/test/java/org/opends/server/core/AddOperationTestCase.java b/opendj-server-legacy/src/test/java/org/opends/server/core/AddOperationTestCase.java
index 3713783..03951f3 100644
--- a/opendj-server-legacy/src/test/java/org/opends/server/core/AddOperationTestCase.java
+++ b/opendj-server-legacy/src/test/java/org/opends/server/core/AddOperationTestCase.java
@@ -1192,7 +1192,7 @@
"objectClass: organization",
"o: test");
- AttributeType attrType = DirectoryServer.getAttributeType("description");
+ AttributeType attrType = DirectoryServer.getAttributeTypeOrNull("description");
Map<AttributeType,List<Attribute>> userAttrs = entry.getUserAttributes();
userAttrs.put(attrType, newArrayList(Attributes.empty(attrType)));
diff --git a/opendj-server-legacy/src/test/java/org/opends/server/core/PasswordPolicyTestCase.java b/opendj-server-legacy/src/test/java/org/opends/server/core/PasswordPolicyTestCase.java
index 62f37a6..8f861e8 100644
--- a/opendj-server-legacy/src/test/java/org/opends/server/core/PasswordPolicyTestCase.java
+++ b/opendj-server-legacy/src/test/java/org/opends/server/core/PasswordPolicyTestCase.java
@@ -2193,7 +2193,7 @@
{
PasswordPolicy p = DirectoryServer.getDefaultPasswordPolicy();
AttributeType t = p.getPasswordAttribute();
- assertEquals(t, DirectoryServer.getAttributeType("userpassword"));
+ assertEquals(t, DirectoryServer.getAttributeTypeOrNull("userpassword"));
}
@@ -2212,7 +2212,7 @@
"cn=config");
PasswordPolicy p = (PasswordPolicy) DirectoryServer.getAuthenticationPolicy(dn);
AttributeType t = p.getPasswordAttribute();
- assertEquals(t, DirectoryServer.getAttributeType("authpassword"));
+ assertEquals(t, DirectoryServer.getAttributeTypeOrNull("authpassword"));
}
@@ -4312,7 +4312,7 @@
{
Entry entry = DirectoryServer.getEntry(DN.valueOf(dn));
assertNotNull(entry);
- AttributeType pwdHistory = DirectoryServer.getAttributeType("pwdhistory");
+ AttributeType pwdHistory = DirectoryServer.getAttributeTypeOrNull("pwdhistory");
assertNotNull(pwdHistory);
Attribute historyAttr = entry.getExactAttribute(pwdHistory, null);
assertNotNull(historyAttr);
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 e165693..f05c70a 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
@@ -332,7 +332,7 @@
private void hasValues(DN dn, String attrTypeLower, String... values) throws DirectoryException
{
Entry entry = DirectoryServer.getEntry(dn);
- AttributeType attrType = DirectoryServer.getAttributeType(attrTypeLower);
+ AttributeType attrType = DirectoryServer.getAttributeTypeOrNull(attrTypeLower);
assertTrue(entry.hasAttribute(attrType));
for (String value : values)
{
@@ -343,7 +343,7 @@
private void doesNotHaveValues(DN dn, String attrTypeLower, String... values) throws DirectoryException
{
Entry entry = DirectoryServer.getEntry(dn);
- AttributeType attrType = DirectoryServer.getAttributeType(attrTypeLower);
+ AttributeType attrType = DirectoryServer.getAttributeTypeOrNull(attrTypeLower);
assertTrue(entry.hasAttribute(attrType));
for (String value : values)
{
@@ -354,7 +354,7 @@
private void hasNoAttribute(DN dn, String lowerName) throws Exception
{
Entry entry = DirectoryServer.getEntry(dn);
- AttributeType attrType = DirectoryServer.getAttributeType(lowerName);
+ AttributeType attrType = DirectoryServer.getAttributeTypeOrNull(lowerName);
assertFalse(entry.hasAttribute(attrType));
}
@@ -367,7 +367,7 @@
assertEquals(searchOperation.getResultCode(), ResultCode.SUCCESS);
assertEquals(searchOperation.getEntriesSent(), 1);
- AttributeType attrType = DirectoryServer.getAttributeType("collectiveattributesubentries");
+ AttributeType attrType = DirectoryServer.getAttributeTypeOrNull("collectiveattributesubentries");
Entry e = searchOperation.getSearchEntries().getFirst();
assertTrue(e.hasValue(attrType, null, ByteString.valueOf(collectiveSubentry.getName())));
}
diff --git a/opendj-server-legacy/src/test/java/org/opends/server/core/SubentryPasswordPolicyTestCase.java b/opendj-server-legacy/src/test/java/org/opends/server/core/SubentryPasswordPolicyTestCase.java
index 7e18121..8a917aa 100644
--- a/opendj-server-legacy/src/test/java/org/opends/server/core/SubentryPasswordPolicyTestCase.java
+++ b/opendj-server-legacy/src/test/java/org/opends/server/core/SubentryPasswordPolicyTestCase.java
@@ -411,16 +411,13 @@
public void testPasswordPolicySubentryAttribute()
throws Exception
{
- PasswordPolicy defaultPolicy =
- DirectoryServer.getDefaultPasswordPolicy();
+ PasswordPolicy defaultPolicy = DirectoryServer.getDefaultPasswordPolicy();
assertNotNull(defaultPolicy);
- Entry testEntry = DirectoryServer.getEntry(DN.valueOf(
- "uid=rogasawara," + BASE));
+ Entry testEntry = DirectoryServer.getEntry(DN.valueOf("uid=rogasawara," + BASE));
assertNotNull(testEntry);
- AttributeType attrType = DirectoryServer.getAttributeType(
- "pwdpolicysubentry");
+ AttributeType attrType = DirectoryServer.getAttributeTypeOrNull("pwdpolicysubentry");
// Make sure that default policy is in effect
// for the user entry.
@@ -444,13 +441,11 @@
);
// Make sure just added policy is in effect.
- testEntry = DirectoryServer.getEntry(DN.valueOf(
- "uid=rogasawara," + BASE));
+ testEntry = DirectoryServer.getEntry(DN.valueOf("uid=rogasawara," + BASE));
assertNotNull(testEntry);
assertTrue(testEntry.hasAttribute(attrType));
- assertTrue(testEntry.hasValue(attrType, null,
- ByteString.valueOf("cn=Temp Policy," + SUFFIX)));
+ assertTrue(testEntry.hasValue(attrType, null, ByteString.valueOf("cn=Temp Policy," + SUFFIX)));
// Remove subentry policy and make sure
// default policy is in effect again.
diff --git a/opendj-server-legacy/src/test/java/org/opends/server/core/TestModifyDNOperation.java b/opendj-server-legacy/src/test/java/org/opends/server/core/TestModifyDNOperation.java
index fbcd4e3..c31ab4f 100644
--- a/opendj-server-legacy/src/test/java/org/opends/server/core/TestModifyDNOperation.java
+++ b/opendj-server-legacy/src/test/java/org/opends/server/core/TestModifyDNOperation.java
@@ -357,7 +357,7 @@
assertEquals(newEntry.getName().toString(),
"uid=USER.0,ou=People,dc=example,dc=com");
- AttributeType at = DirectoryServer.getAttributeType("uid");
+ AttributeType at = DirectoryServer.getAttributeTypeOrNull("uid");
List<Attribute> attrList = newEntry.getAttribute(at);
// There should be only one value for "uid"
@@ -422,7 +422,7 @@
assertEquals(newEntry.getName().toString(),
"uid=UserID.0+cn=Test,ou=People,dc=example,dc=com");
- AttributeType at = DirectoryServer.getAttributeType("uid");
+ AttributeType at = DirectoryServer.getAttributeTypeOrNull("uid");
List<Attribute> attrList = newEntry.getAttribute(at);
// There should be only one value for "uid"
@@ -473,7 +473,7 @@
assertEquals(newEntry.getName().toString(),
"uid=userid.0+sn=JENSEN,ou=People,dc=example,dc=com");
- AttributeType at = DirectoryServer.getAttributeType("sn");
+ AttributeType at = DirectoryServer.getAttributeTypeOrNull("sn");
List<Attribute> attrList = newEntry.getAttribute(at);
// There should be only one value for "sn"
diff --git a/opendj-server-legacy/src/test/java/org/opends/server/extensions/EntityTagVirtualAttributeProviderTestCase.java b/opendj-server-legacy/src/test/java/org/opends/server/extensions/EntityTagVirtualAttributeProviderTestCase.java
index 75bd7ce..8f1dc95 100644
--- a/opendj-server-legacy/src/test/java/org/opends/server/extensions/EntityTagVirtualAttributeProviderTestCase.java
+++ b/opendj-server-legacy/src/test/java/org/opends/server/extensions/EntityTagVirtualAttributeProviderTestCase.java
@@ -221,7 +221,7 @@
TestCaseUtils.startServer();
// Initialize the provider.
- config.getExcludedAttribute().add(DirectoryServer.getAttributeType("modifytimestamp"));
+ config.getExcludedAttribute().add(DirectoryServer.getAttributeTypeOrNull("modifytimestamp"));
provider.initializeVirtualAttributeProvider(config);
}
@@ -453,7 +453,7 @@
final SearchOperation searchOp = mock(SearchOperation.class);
VirtualAttributeRule rule = new VirtualAttributeRule(
- DirectoryServer.getAttributeType(ETAG), provider,
+ DirectoryServer.getAttributeTypeOrNull(ETAG), provider,
Collections.<DN> emptySet(), SearchScope.WHOLE_SUBTREE,
Collections.<DN> emptySet(), Collections.<SearchFilter> emptySet(),
VirtualAttributeCfgDefn.ConflictBehavior.REAL_OVERRIDES_VIRTUAL);
@@ -739,7 +739,7 @@
private VirtualAttributeRule getRule()
{
- AttributeType type = DirectoryServer.getAttributeType("etag");
+ AttributeType type = DirectoryServer.getAttributeTypeOrNull("etag");
return new VirtualAttributeRule(type, provider,
Collections.<DN>emptySet(), SearchScope.WHOLE_SUBTREE,
Collections.<DN>emptySet(),
diff --git a/opendj-server-legacy/src/test/java/org/opends/server/extensions/EntryDNVirtualAttributeProviderTestCase.java b/opendj-server-legacy/src/test/java/org/opends/server/extensions/EntryDNVirtualAttributeProviderTestCase.java
index a5dcc7b..942ee4e 100644
--- a/opendj-server-legacy/src/test/java/org/opends/server/extensions/EntryDNVirtualAttributeProviderTestCase.java
+++ b/opendj-server-legacy/src/test/java/org/opends/server/extensions/EntryDNVirtualAttributeProviderTestCase.java
@@ -76,7 +76,7 @@
TestCaseUtils.initializeTestBackend(true);
TestCaseUtils.clearJEBackend("userRoot", "dc=example,dc=com");
- entryDNType = DirectoryServer.getAttributeType("entrydn");
+ entryDNType = DirectoryServer.getAttributeTypeOrNull("entrydn");
assertNotNull(entryDNType);
}
diff --git a/opendj-server-legacy/src/test/java/org/opends/server/extensions/EntryUUIDVirtualAttributeProviderTestCase.java b/opendj-server-legacy/src/test/java/org/opends/server/extensions/EntryUUIDVirtualAttributeProviderTestCase.java
index b250c8b..be9f3e4 100644
--- a/opendj-server-legacy/src/test/java/org/opends/server/extensions/EntryUUIDVirtualAttributeProviderTestCase.java
+++ b/opendj-server-legacy/src/test/java/org/opends/server/extensions/EntryUUIDVirtualAttributeProviderTestCase.java
@@ -71,7 +71,7 @@
{
TestCaseUtils.startServer();
- entryUUIDType = DirectoryServer.getAttributeType("entryuuid");
+ entryUUIDType = DirectoryServer.getAttributeTypeOrNull("entryuuid");
assertNotNull(entryUUIDType);
}
diff --git a/opendj-server-legacy/src/test/java/org/opends/server/extensions/ExactMatchIdentityMapperTestCase.java b/opendj-server-legacy/src/test/java/org/opends/server/extensions/ExactMatchIdentityMapperTestCase.java
index 1f01b07..0be654b 100644
--- a/opendj-server-legacy/src/test/java/org/opends/server/extensions/ExactMatchIdentityMapperTestCase.java
+++ b/opendj-server-legacy/src/test/java/org/opends/server/extensions/ExactMatchIdentityMapperTestCase.java
@@ -143,7 +143,7 @@
"ds-cfg-enabled: true",
"ds-cfg-match-attribute: uid");
- AttributeType t = DirectoryServer.getAttributeType("ds-cfg-match-base-dn");
+ AttributeType t = DirectoryServer.getAttributeTypeOrNull("ds-cfg-match-base-dn");
e.addAttribute(Attributes.empty(t), new ArrayList<ByteString>());
entries.add(e);
diff --git a/opendj-server-legacy/src/test/java/org/opends/server/extensions/FingerprintCertificateMapperTestCase.java b/opendj-server-legacy/src/test/java/org/opends/server/extensions/FingerprintCertificateMapperTestCase.java
index 326da0a..5a6bd3e 100644
--- a/opendj-server-legacy/src/test/java/org/opends/server/extensions/FingerprintCertificateMapperTestCase.java
+++ b/opendj-server-legacy/src/test/java/org/opends/server/extensions/FingerprintCertificateMapperTestCase.java
@@ -434,20 +434,16 @@
/**
- * Tests to ensure that an attmept to remove the fingerprint attribute will
- * fail.
+ * Tests to ensure that an attmept to remove the fingerprint attribute will fail.
*
* @throws Exception If an unexpected problem occurs.
*/
@Test
- public void testRemoveFingerprintAttribute()
- throws Exception
+ public void testRemoveFingerprintAttribute() throws Exception
{
String mapperDN = "cn=Fingerprint Mapper,cn=Certificate Mappers,cn=config";
- Attribute a =
- Attributes.empty(DirectoryServer.getAttributeType(
- "ds-cfg-fingerprint-attribute"));
+ Attribute a = Attributes.empty(DirectoryServer.getAttributeTypeOrNull("ds-cfg-fingerprint-attribute"));
ArrayList<Modification> mods = newArrayList(new Modification(DELETE, a));
ModifyOperation modifyOperation =
@@ -463,14 +459,11 @@
* @throws Exception If an unexpected problem occurs.
*/
@Test
- public void testRemoveFingerprintAlgorithm()
- throws Exception
+ public void testRemoveFingerprintAlgorithm() throws Exception
{
String mapperDN = "cn=Fingerprint Mapper,cn=Certificate Mappers,cn=config";
- Attribute a =
- Attributes.empty(DirectoryServer.getAttributeType(
- "ds-cfg-fingerprint-algorithm"));
+ Attribute a = Attributes.empty(DirectoryServer.getAttributeTypeOrNull("ds-cfg-fingerprint-algorithm"));
ArrayList<Modification> mods = newArrayList(new Modification(DELETE, a));
ModifyOperation modifyOperation =
diff --git a/opendj-server-legacy/src/test/java/org/opends/server/extensions/GoverningStructureRuleVirtualAttributeProviderTestCase.java b/opendj-server-legacy/src/test/java/org/opends/server/extensions/GoverningStructureRuleVirtualAttributeProviderTestCase.java
index c694240..00f8423 100644
--- a/opendj-server-legacy/src/test/java/org/opends/server/extensions/GoverningStructureRuleVirtualAttributeProviderTestCase.java
+++ b/opendj-server-legacy/src/test/java/org/opends/server/extensions/GoverningStructureRuleVirtualAttributeProviderTestCase.java
@@ -80,7 +80,7 @@
TestCaseUtils.initializeTestBackend(true);
TestCaseUtils.clearJEBackend("userRoot", "dc=example,dc=com");
- governingStructureRuleType = DirectoryServer.getAttributeType("governingstructurerule");
+ governingStructureRuleType = DirectoryServer.getAttributeTypeOrNull("governingstructurerule");
assertNotNull(governingStructureRuleType);
int resultCode = TestCaseUtils.applyModifications(true,
"dn: cn=schema",
diff --git a/opendj-server-legacy/src/test/java/org/opends/server/extensions/HasSubordinatesVirtualAttributeProviderTestCase.java b/opendj-server-legacy/src/test/java/org/opends/server/extensions/HasSubordinatesVirtualAttributeProviderTestCase.java
index 674ee03..16b0dc4 100644
--- a/opendj-server-legacy/src/test/java/org/opends/server/extensions/HasSubordinatesVirtualAttributeProviderTestCase.java
+++ b/opendj-server-legacy/src/test/java/org/opends/server/extensions/HasSubordinatesVirtualAttributeProviderTestCase.java
@@ -70,7 +70,7 @@
{
TestCaseUtils.startServer();
- hasSubordinatesType = DirectoryServer.getAttributeType("hassubordinates");
+ hasSubordinatesType = DirectoryServer.getAttributeTypeOrNull("hassubordinates");
assertNotNull(hasSubordinatesType);
entries = TestCaseUtils.makeEntries(
diff --git a/opendj-server-legacy/src/test/java/org/opends/server/extensions/IsMemberOfVirtualAttributeProviderTestCase.java b/opendj-server-legacy/src/test/java/org/opends/server/extensions/IsMemberOfVirtualAttributeProviderTestCase.java
index ab6a0a6..b52f7e7 100644
--- a/opendj-server-legacy/src/test/java/org/opends/server/extensions/IsMemberOfVirtualAttributeProviderTestCase.java
+++ b/opendj-server-legacy/src/test/java/org/opends/server/extensions/IsMemberOfVirtualAttributeProviderTestCase.java
@@ -80,7 +80,7 @@
{
TestCaseUtils.restartServer();
- isMemberOfType = DirectoryServer.getAttributeType("ismemberof");
+ isMemberOfType = DirectoryServer.getAttributeTypeOrNull("ismemberof");
assertNotNull(isMemberOfType);
}
diff --git a/opendj-server-legacy/src/test/java/org/opends/server/extensions/NumSubordinatesVirtualAttributeProviderTestCase.java b/opendj-server-legacy/src/test/java/org/opends/server/extensions/NumSubordinatesVirtualAttributeProviderTestCase.java
index b14da7f..572f9bd 100644
--- a/opendj-server-legacy/src/test/java/org/opends/server/extensions/NumSubordinatesVirtualAttributeProviderTestCase.java
+++ b/opendj-server-legacy/src/test/java/org/opends/server/extensions/NumSubordinatesVirtualAttributeProviderTestCase.java
@@ -66,7 +66,7 @@
{
TestCaseUtils.restartServer();
- numSubordinatesType = DirectoryServer.getAttributeType("numsubordinates");
+ numSubordinatesType = DirectoryServer.getAttributeTypeOrNull("numsubordinates");
assertNotNull(numSubordinatesType);
entries = TestCaseUtils.makeEntries(
diff --git a/opendj-server-legacy/src/test/java/org/opends/server/extensions/PasswordModifyExtendedOperationTestCase.java b/opendj-server-legacy/src/test/java/org/opends/server/extensions/PasswordModifyExtendedOperationTestCase.java
index 0dcf58a..48a874f 100644
--- a/opendj-server-legacy/src/test/java/org/opends/server/extensions/PasswordModifyExtendedOperationTestCase.java
+++ b/opendj-server-legacy/src/test/java/org/opends/server/extensions/PasswordModifyExtendedOperationTestCase.java
@@ -1695,7 +1695,7 @@
try
{
- AttributeType lastLoginTimeAttr = DirectoryServer.getAttributeType("ds-pwp-last-login-time");
+ AttributeType lastLoginTimeAttr = DirectoryServer.getAttributeTypeOrNull("ds-pwp-last-login-time");
assertNotNull(lastLoginTimeAttr);
DN userDN = DN.valueOf("uid=test.user,o=test");
@@ -1752,7 +1752,7 @@
try
{
- AttributeType authFailureTimesAttr = DirectoryServer.getAttributeType("pwdfailuretime");
+ AttributeType authFailureTimesAttr = DirectoryServer.getAttributeTypeOrNull("pwdfailuretime");
assertNotNull(authFailureTimesAttr);
DN userDN = DN.valueOf("uid=test.user,o=test");
@@ -1803,7 +1803,7 @@
try
{
- AttributeType pwdHistoryAttr = DirectoryServer.getAttributeType("pwdhistory");
+ AttributeType pwdHistoryAttr = DirectoryServer.getAttributeTypeOrNull("pwdhistory");
assertNotNull(pwdHistoryAttr);
DN userDN = DN.valueOf("uid=test.user,o=test");
diff --git a/opendj-server-legacy/src/test/java/org/opends/server/extensions/StructuralObjectClassVirtualAttributeProviderTestCase.java b/opendj-server-legacy/src/test/java/org/opends/server/extensions/StructuralObjectClassVirtualAttributeProviderTestCase.java
index 00852a8..788427b 100644
--- a/opendj-server-legacy/src/test/java/org/opends/server/extensions/StructuralObjectClassVirtualAttributeProviderTestCase.java
+++ b/opendj-server-legacy/src/test/java/org/opends/server/extensions/StructuralObjectClassVirtualAttributeProviderTestCase.java
@@ -77,7 +77,7 @@
TestCaseUtils.initializeTestBackend(true);
TestCaseUtils.clearJEBackend("userRoot", "dc=example,dc=com");
- structuralObjectClassType = DirectoryServer.getAttributeType("structuralobjectclass");
+ structuralObjectClassType = DirectoryServer.getAttributeTypeOrNull("structuralobjectclass");
assertNotNull(structuralObjectClassType);
}
diff --git a/opendj-server-legacy/src/test/java/org/opends/server/extensions/SubjectAttributeToUserAttributeCertificateMapperTestCase.java b/opendj-server-legacy/src/test/java/org/opends/server/extensions/SubjectAttributeToUserAttributeCertificateMapperTestCase.java
index 3dae3ed..b348f1b 100644
--- a/opendj-server-legacy/src/test/java/org/opends/server/extensions/SubjectAttributeToUserAttributeCertificateMapperTestCase.java
+++ b/opendj-server-legacy/src/test/java/org/opends/server/extensions/SubjectAttributeToUserAttributeCertificateMapperTestCase.java
@@ -85,72 +85,59 @@
* @throws Exception If an unexpected problem occurs.
*/
@DataProvider(name = "invalidConfigs")
- public Object[][] getInvalidConfigurations()
- throws Exception
+ public Object[][] getInvalidConfigurations() throws Exception
{
List<Entry> entries = TestCaseUtils.makeEntries(
"dn: cn=No Map Attr,cn=Certificate Mappers,cn=config",
"objectClass: top",
"objectClass: ds-cfg-certificate-mapper",
- "objectClass: " +
- "ds-cfg-subject-attribute-to-user-attribute-certificate-mapper",
+ "objectClass: ds-cfg-subject-attribute-to-user-attribute-certificate-mapper",
"cn: No Map Attr",
- "ds-cfg-java-class: org.opends.server.extensions." +
- "SubjectAttributeToUserAttributeCertificateMapper",
+ "ds-cfg-java-class: org.opends.server.extensions.SubjectAttributeToUserAttributeCertificateMapper",
"ds-cfg-enabled: true",
"",
"dn: cn=No Map Colon,cn=Certificate Mappers,cn=config",
"objectClass: top",
"objectClass: ds-cfg-certificate-mapper",
- "objectClass: " +
- "ds-cfg-subject-attribute-to-user-attribute-certificate-mapper",
+ "objectClass: ds-cfg-subject-attribute-to-user-attribute-certificate-mapper",
"cn: No Map Colon",
- "ds-cfg-java-class: org.opends.server.extensions." +
- "SubjectAttributeToUserAttributeCertificateMapper",
+ "ds-cfg-java-class: org.opends.server.extensions.SubjectAttributeToUserAttributeCertificateMapper",
"ds-cfg-enabled: true",
"ds-cfg-subject-attribute-mapping: nomapcolon",
"",
"dn: cn=No Map Cert Attr,cn=Certificate Mappers,cn=config",
"objectClass: top",
"objectClass: ds-cfg-certificate-mapper",
- "objectClass: " +
- "ds-cfg-subject-attribute-to-user-attribute-certificate-mapper",
+ "objectClass: ds-cfg-subject-attribute-to-user-attribute-certificate-mapper",
"cn: No Map Cert Attr",
- "ds-cfg-java-class: org.opends.server.extensions." +
- "SubjectAttributeToUserAttributeCertificateMapper",
+ "ds-cfg-java-class: org.opends.server.extensions.SubjectAttributeToUserAttributeCertificateMapper",
"ds-cfg-enabled: true",
"ds-cfg-subject-attribute-mapping: :cn",
"",
"dn: cn=No Map User Attr,cn=Certificate Mappers,cn=config",
"objectClass: top",
"objectClass: ds-cfg-certificate-mapper",
- "objectClass: " +
- "ds-cfg-subject-attribute-to-user-attribute-certificate-mapper",
+ "objectClass: ds-cfg-subject-attribute-to-user-attribute-certificate-mapper",
"cn: No Map User Attr",
- "ds-cfg-java-class: org.opends.server.extensions." +
- "SubjectAttributeToUserAttributeCertificateMapper",
+ "ds-cfg-java-class: org.opends.server.extensions.SubjectAttributeToUserAttributeCertificateMapper",
"ds-cfg-enabled: true",
"ds-cfg-subject-attribute-mapping: cn:",
"",
"dn: cn=Undefined User Attr,cn=Certificate Mappers,cn=config",
"objectClass: top",
"objectClass: ds-cfg-certificate-mapper",
- "objectClass: " +
- "ds-cfg-subject-attribute-to-user-attribute-certificate-mapper",
+ "objectClass: ds-cfg-subject-attribute-to-user-attribute-certificate-mapper",
"cn: Undefined User Attr",
- "ds-cfg-java-class: org.opends.server.extensions." +
- "SubjectAttributeToUserAttributeCertificateMapper",
+ "ds-cfg-java-class: org.opends.server.extensions.SubjectAttributeToUserAttributeCertificateMapper",
"ds-cfg-enabled: true",
"ds-cfg-subject-attribute-mapping: cn:undefined",
"",
"dn: cn=Duplicate Cert Attr,cn=Certificate Mappers,cn=config",
"objectClass: top",
"objectClass: ds-cfg-certificate-mapper",
- "objectClass: " +
- "ds-cfg-subject-attribute-to-user-attribute-certificate-mapper",
+ "objectClass: ds-cfg-subject-attribute-to-user-attribute-certificate-mapper",
"cn: Duplicate Cert Attr",
- "ds-cfg-java-class: org.opends.server.extensions." +
- "SubjectAttributeToUserAttributeCertificateMapper",
+ "ds-cfg-java-class: org.opends.server.extensions.SubjectAttributeToUserAttributeCertificateMapper",
"ds-cfg-enabled: true",
"ds-cfg-subject-attribute-mapping: cn:cn",
"ds-cfg-subject-attribute-mapping: cn:sn",
@@ -158,11 +145,9 @@
"dn: cn=Duplicate User Attr,cn=Certificate Mappers,cn=config",
"objectClass: top",
"objectClass: ds-cfg-certificate-mapper",
- "objectClass: " +
- "ds-cfg-subject-attribute-to-user-attribute-certificate-mapper",
+ "objectClass: ds-cfg-subject-attribute-to-user-attribute-certificate-mapper",
"cn: Duplicate User Attr",
- "ds-cfg-java-class: org.opends.server.extensions." +
- "SubjectAttributeToUserAttributeCertificateMapper",
+ "ds-cfg-java-class: org.opends.server.extensions.SubjectAttributeToUserAttributeCertificateMapper",
"ds-cfg-enabled: true",
"ds-cfg-subject-attribute-mapping: cn:cn",
"ds-cfg-subject-attribute-mapping: e:cn",
@@ -182,11 +167,9 @@
"dn: cn=Duplicate Cert Attr OID and Name,cn=Certificate Mappers,cn=config",
"objectClass: top",
"objectClass: ds-cfg-certificate-mapper",
- "objectClass: " +
- "ds-cfg-subject-attribute-to-user-attribute-certificate-mapper",
+ "objectClass: ds-cfg-subject-attribute-to-user-attribute-certificate-mapper",
"cn: Duplicate Cert Attr OID and Name",
- "ds-cfg-java-class: org.opends.server.extensions." +
- "SubjectAttributeToUserAttributeCertificateMapper",
+ "ds-cfg-java-class: org.opends.server.extensions.SubjectAttributeToUserAttributeCertificateMapper",
"ds-cfg-enabled: true",
"ds-cfg-subject-attribute-mapping: cn:cn",
"ds-cfg-subject-attribute-mapping: 2.5.4.3:displayName");
@@ -731,12 +714,9 @@
public void testRemoveMapAttribute()
throws Exception
{
- String mapperDN = "cn=Subject Attribute to User Attribute," +
- "cn=Certificate Mappers,cn=config";
+ String mapperDN = "cn=Subject Attribute to User Attribute,cn=Certificate Mappers,cn=config";
- Attribute a =
- Attributes.empty(DirectoryServer.getAttributeType(
- "ds-cfg-subject-attribute-mapping"));
+ Attribute a = Attributes.empty(DirectoryServer.getAttributeTypeOrNull("ds-cfg-subject-attribute-mapping"));
ArrayList<Modification> mods = newArrayList(
new Modification(ModificationType.DELETE, a));
@@ -912,13 +892,11 @@
*
* @throws Exception If an unexpected problem occurs.
*/
- private void setBaseDNs(String[] baseDNs)
- throws Exception
+ private void setBaseDNs(String[] baseDNs) throws Exception
{
- String mapperDN = "cn=Subject Attribute to User Attribute," +
- "cn=Certificate Mappers,cn=config";
+ String mapperDN = "cn=Subject Attribute to User Attribute,cn=Certificate Mappers,cn=config";
- AttributeType attrType = DirectoryServer.getAttributeType("ds-cfg-user-base-dn");
+ AttributeType attrType = DirectoryServer.getAttributeTypeOrNull("ds-cfg-user-base-dn");
AttributeBuilder builder = new AttributeBuilder(attrType);
if (baseDNs != null)
{
diff --git a/opendj-server-legacy/src/test/java/org/opends/server/extensions/SubjectDNToUserAttributeCertificateMapperTestCase.java b/opendj-server-legacy/src/test/java/org/opends/server/extensions/SubjectDNToUserAttributeCertificateMapperTestCase.java
index 6230a7a..9e99feb 100644
--- a/opendj-server-legacy/src/test/java/org/opends/server/extensions/SubjectDNToUserAttributeCertificateMapperTestCase.java
+++ b/opendj-server-legacy/src/test/java/org/opends/server/extensions/SubjectDNToUserAttributeCertificateMapperTestCase.java
@@ -86,8 +86,7 @@
* @throws Exception If an unexpected problem occurs.
*/
@DataProvider(name = "invalidConfigs")
- public Object[][] getInvalidConfigurations()
- throws Exception
+ public Object[][] getInvalidConfigurations() throws Exception
{
List<Entry> entries = TestCaseUtils.makeEntries(
"dn: cn=No Subject Attr,cn=Certificate Mappers,cn=config",
@@ -95,8 +94,7 @@
"objectClass: ds-cfg-certificate-mapper",
"objectClass: ds-cfg-subject-dn-to-user-attribute-certificate-mapper",
"cn: No Subject Attr",
- "ds-cfg-java-class: org.opends.server.extensions." +
- "SubjectDNToUserAttributeCertificateMapper",
+ "ds-cfg-java-class: org.opends.server.extensions.SubjectDNToUserAttributeCertificateMapper",
"ds-cfg-enabled: true",
"",
"dn: cn=Undefined Subject Attr,cn=Certificate Mappers,cn=config",
@@ -104,8 +102,7 @@
"objectClass: ds-cfg-certificate-mapper",
"objectClass: ds-cfg-subject-dn-to-user-attribute-certificate-mapper",
"cn: Undefined Subject Attr",
- "ds-cfg-java-class: org.opends.server.extensions." +
- "SubjectDNToUserAttributeCertificateMapper",
+ "ds-cfg-java-class: org.opends.server.extensions.SubjectDNToUserAttributeCertificateMapper",
"ds-cfg-enabled: true",
"ds-cfg-subject-attribute: undefined",
"",
@@ -114,8 +111,7 @@
"objectClass: ds-cfg-certificate-mapper",
"objectClass: ds-cfg-subject-dn-to-user-attribute-certificate-mapper",
"cn: Invalid Base DN",
- "ds-cfg-java-class: org.opends.server.extensions." +
- "SubjectDNToUserAttributeCertificateMapper",
+ "ds-cfg-java-class: org.opends.server.extensions.SubjectDNToUserAttributeCertificateMapper",
"ds-cfg-enabled: true",
"ds-cfg-subject-attribute: ds-certificate-subject-dn",
"ds-cfg-user-base-dn: invalid");
@@ -546,7 +542,7 @@
throws Exception
{
String mapperDN = "cn=Subject DN to User Attribute,cn=Certificate Mappers,cn=config";
- Attribute a = Attributes.empty(DirectoryServer.getAttributeType("ds-cfg-subject-attribute"));
+ Attribute a = Attributes.empty(DirectoryServer.getAttributeTypeOrNull("ds-cfg-subject-attribute"));
ArrayList<Modification> mods = newArrayList(new Modification(ModificationType.DELETE, a));
ModifyOperation modifyOperation =
@@ -652,13 +648,11 @@
*
* @throws Exception If an unexpected problem occurs.
*/
- private void setBaseDNs(String[] baseDNs)
- throws Exception
+ private void setBaseDNs(String[] baseDNs) throws Exception
{
- String mapperDN =
- "cn=Subject DN to User Attribute,cn=Certificate Mappers,cn=config";
+ String mapperDN = "cn=Subject DN to User Attribute,cn=Certificate Mappers,cn=config";
- AttributeType attrType = DirectoryServer.getAttributeType("ds-cfg-user-base-dn");
+ AttributeType attrType = DirectoryServer.getAttributeTypeOrNull("ds-cfg-user-base-dn");
AttributeBuilder builder = new AttributeBuilder(attrType);
if (baseDNs != null)
{
@@ -676,8 +670,7 @@
* @throws Exception If an unexpected problem occurs.
*/
@Test
- public void testPrivilegeWithSuccessfulMappingDefaultConfig()
- throws Exception
+ public void testPrivilegeWithSuccessfulMappingDefaultConfig() throws Exception
{
enableMapper();
diff --git a/opendj-server-legacy/src/test/java/org/opends/server/extensions/SubschemaSubentryVirtualAttributeProviderTestCase.java b/opendj-server-legacy/src/test/java/org/opends/server/extensions/SubschemaSubentryVirtualAttributeProviderTestCase.java
index 7940198..6db9b7d 100644
--- a/opendj-server-legacy/src/test/java/org/opends/server/extensions/SubschemaSubentryVirtualAttributeProviderTestCase.java
+++ b/opendj-server-legacy/src/test/java/org/opends/server/extensions/SubschemaSubentryVirtualAttributeProviderTestCase.java
@@ -76,7 +76,7 @@
TestCaseUtils.initializeTestBackend(true);
TestCaseUtils.clearJEBackend("userRoot", "dc=example,dc=com");
- subschemaSubentryType = DirectoryServer.getAttributeType("subschemasubentry");
+ subschemaSubentryType = DirectoryServer.getAttributeTypeOrNull("subschemasubentry");
assertNotNull(subschemaSubentryType);
}
diff --git a/opendj-server-legacy/src/test/java/org/opends/server/extensions/UserDefinedVirtualAttributeProviderTestCase.java b/opendj-server-legacy/src/test/java/org/opends/server/extensions/UserDefinedVirtualAttributeProviderTestCase.java
index 11e1e08..dabd964 100644
--- a/opendj-server-legacy/src/test/java/org/opends/server/extensions/UserDefinedVirtualAttributeProviderTestCase.java
+++ b/opendj-server-legacy/src/test/java/org/opends/server/extensions/UserDefinedVirtualAttributeProviderTestCase.java
@@ -77,13 +77,13 @@
{
TestCaseUtils.startServer();
- descriptionType = DirectoryServer.getAttributeType("description");
+ descriptionType = DirectoryServer.getAttributeTypeOrNull("description");
assertNotNull(descriptionType);
- pwPolicyDNType = DirectoryServer.getAttributeType("ds-pwp-password-policy-dn");
+ pwPolicyDNType = DirectoryServer.getAttributeTypeOrNull("ds-pwp-password-policy-dn");
assertNotNull(pwPolicyDNType);
- privNameType = DirectoryServer.getAttributeType("ds-privilege-name");
+ privNameType = DirectoryServer.getAttributeTypeOrNull("ds-privilege-name");
assertNotNull(privNameType);
}
diff --git a/opendj-server-legacy/src/test/java/org/opends/server/extensions/VirtualStaticGroupTestCase.java b/opendj-server-legacy/src/test/java/org/opends/server/extensions/VirtualStaticGroupTestCase.java
index 09ce148..e9f91e5 100644
--- a/opendj-server-legacy/src/test/java/org/opends/server/extensions/VirtualStaticGroupTestCase.java
+++ b/opendj-server-legacy/src/test/java/org/opends/server/extensions/VirtualStaticGroupTestCase.java
@@ -252,10 +252,10 @@
{
TestCaseUtils.startServer();
- memberType = DirectoryServer.getAttributeType("member");
+ memberType = DirectoryServer.getAttributeTypeOrNull("member");
assertNotNull(memberType);
- uniqueMemberType = DirectoryServer.getAttributeType("uniquemember");
+ uniqueMemberType = DirectoryServer.getAttributeTypeOrNull("uniquemember");
assertNotNull(uniqueMemberType);
groupManager = DirectoryServer.getGroupManager();
diff --git a/opendj-server-legacy/src/test/java/org/opends/server/plugins/EntryUUIDPluginTestCase.java b/opendj-server-legacy/src/test/java/org/opends/server/plugins/EntryUUIDPluginTestCase.java
index c5a88a0..0f1a3e8 100644
--- a/opendj-server-legacy/src/test/java/org/opends/server/plugins/EntryUUIDPluginTestCase.java
+++ b/opendj-server-legacy/src/test/java/org/opends/server/plugins/EntryUUIDPluginTestCase.java
@@ -158,7 +158,7 @@
public void testInitializeWithValidConfigsWithoutSchema(Entry e)
throws Exception
{
- AttributeType entryUUIDType = DirectoryServer.getAttributeType("entryuuid");
+ AttributeType entryUUIDType = DirectoryServer.getAttributeTypeOrNull("entryuuid");
DirectoryServer.deregisterAttributeType(entryUUIDType);
HashSet<PluginType> pluginTypes = TestCaseUtils.getPluginTypes(e);
diff --git a/opendj-server-legacy/src/test/java/org/opends/server/plugins/LastModPluginTestCase.java b/opendj-server-legacy/src/test/java/org/opends/server/plugins/LastModPluginTestCase.java
index fffbfa6..07ab0e7 100644
--- a/opendj-server-legacy/src/test/java/org/opends/server/plugins/LastModPluginTestCase.java
+++ b/opendj-server-legacy/src/test/java/org/opends/server/plugins/LastModPluginTestCase.java
@@ -173,10 +173,10 @@
public void testInitializeWithValidConfigsWithoutSchema(Entry e)
throws Exception
{
- AttributeType ctType = DirectoryServer.getAttributeType("createtimestamp");
- AttributeType cnType = DirectoryServer.getAttributeType("creatorsname");
- AttributeType mtType = DirectoryServer.getAttributeType("modifytimestamp");
- AttributeType mnType = DirectoryServer.getAttributeType("modifiersname");
+ AttributeType ctType = DirectoryServer.getAttributeTypeOrNull("createtimestamp");
+ AttributeType cnType = DirectoryServer.getAttributeTypeOrNull("creatorsname");
+ AttributeType mtType = DirectoryServer.getAttributeTypeOrNull("modifytimestamp");
+ AttributeType mnType = DirectoryServer.getAttributeTypeOrNull("modifiersname");
DirectoryServer.deregisterAttributeType(ctType);
DirectoryServer.deregisterAttributeType(cnType);
diff --git a/opendj-server-legacy/src/test/java/org/opends/server/replication/DependencyTest.java b/opendj-server-legacy/src/test/java/org/opends/server/replication/DependencyTest.java
index d0ddddc..5aaf401 100644
--- a/opendj-server-legacy/src/test/java/org/opends/server/replication/DependencyTest.java
+++ b/opendj-server-legacy/src/test/java/org/opends/server/replication/DependencyTest.java
@@ -144,7 +144,7 @@
int sequence;
for (sequence = 1; sequence<=addSequenceLength; sequence ++)
{
- entry.removeAttribute(getAttributeType("entryuuid"));
+ entry.removeAttribute(getAttributeTypeOrNull("entryuuid"));
entry.addAttribute(Attributes.create("entryuuid", stringUID(sequence+1)),
new LinkedList<ByteString>());
addDN = DN.valueOf("dc=dependency" + sequence + "," + addDN);
@@ -271,7 +271,7 @@
baseDN, brokerId, 1000, replServer.getReplicationPort(), 1000, CLEAN_DB_GENERATION_ID);
// add an entry to play with.
- entry.removeAttribute(getAttributeType("entryuuid"));
+ entry.removeAttribute(getAttributeTypeOrNull("entryuuid"));
entry.addAttribute(Attributes.create("entryuuid",
stringUID(renamedEntryUuid)),
new LinkedList<ByteString>());
@@ -370,7 +370,7 @@
for (sequence = 1; sequence<=addSequenceLength; sequence ++)
{
// add the entry a first time
- entry.removeAttribute(getAttributeType("entryuuid"));
+ entry.removeAttribute(getAttributeTypeOrNull("entryuuid"));
entry.addAttribute(Attributes.create("entryuuid", stringUID(sequence+1)),
new LinkedList<ByteString>());
DN addDN = DN.valueOf("dc=dependency" + sequence + "," + TEST_ROOT_DN_STRING);
@@ -378,7 +378,7 @@
broker.publish(delMsg(addDN, sequence + 1, gen));
// add again the entry with a new entryuuid.
- entry.removeAttribute(getAttributeType("entryuuid"));
+ entry.removeAttribute(getAttributeTypeOrNull("entryuuid"));
entry.addAttribute(Attributes.create("entryuuid", stringUID(sequence+1025)),
new LinkedList<ByteString>());
broker.publish(addMsg(addDN, entry, sequence + 1025, 1, gen));
@@ -477,7 +477,7 @@
for (sequence = 1; sequence<=addSequenceLength; sequence ++)
{
// add the entry
- entry.removeAttribute(getAttributeType("entryuuid"));
+ entry.removeAttribute(getAttributeTypeOrNull("entryuuid"));
entry.addAttribute(Attributes.create("entryuuid", stringUID(sequence+1)),
new LinkedList<ByteString>());
addDN = DN.valueOf("dc=dependency" + sequence + "," + TEST_ROOT_DN_STRING);
diff --git a/opendj-server-legacy/src/test/java/org/opends/server/replication/GenerationIdTest.java b/opendj-server-legacy/src/test/java/org/opends/server/replication/GenerationIdTest.java
index 7c88c33..74c9e7a 100644
--- a/opendj-server-legacy/src/test/java/org/opends/server/replication/GenerationIdTest.java
+++ b/opendj-server-legacy/src/test/java/org/opends/server/replication/GenerationIdTest.java
@@ -481,7 +481,7 @@
{
debugInfo("Entry found <" + baseDN + ">");
- AttributeType synchronizationGenIDType = DirectoryServer.getAttributeType(REPLICATION_GENERATION_ID);
+ AttributeType synchronizationGenIDType = DirectoryServer.getAttributeTypeOrNull(REPLICATION_GENERATION_ID);
Attribute attr = resultEntry.getExactAttribute(synchronizationGenIDType, new HashSet<String>());
return Long.valueOf(attr.iterator().next().toString());
}
diff --git a/opendj-server-legacy/src/test/java/org/opends/server/replication/UpdateOperationTest.java b/opendj-server-legacy/src/test/java/org/opends/server/replication/UpdateOperationTest.java
index fa6c12a..0bee1a1 100644
--- a/opendj-server-legacy/src/test/java/org/opends/server/replication/UpdateOperationTest.java
+++ b/opendj-server-legacy/src/test/java/org/opends/server/replication/UpdateOperationTest.java
@@ -427,10 +427,8 @@
{
testSetUp("modifyConflicts");
final DN dn1 = DN.valueOf("cn=test1," + baseDN);
- final AttributeType attrType =
- DirectoryServer.getAttributeType("displayname");
- final AttributeType entryuuidType =
- DirectoryServer.getAttributeType("entryuuid");
+ final AttributeType attrType = DirectoryServer.getAttributeTypeOrNull("displayname");
+ final AttributeType entryuuidType = DirectoryServer.getAttributeTypeOrNull("entryuuid");
String monitorAttr = "resolved-modify-conflicts";
/*
diff --git a/opendj-server-legacy/src/test/java/org/opends/server/replication/plugin/AttrHistoricalMultipleTest.java b/opendj-server-legacy/src/test/java/org/opends/server/replication/plugin/AttrHistoricalMultipleTest.java
index d1b04f3..18f5a1c 100644
--- a/opendj-server-legacy/src/test/java/org/opends/server/replication/plugin/AttrHistoricalMultipleTest.java
+++ b/opendj-server-legacy/src/test/java/org/opends/server/replication/plugin/AttrHistoricalMultipleTest.java
@@ -162,7 +162,7 @@
assertEquals(attrInfo4.getValuesHistorical().size(), 1);
// Check
- AttributeType type = DirectoryServer.getAttributeType(ATTRIBUTE_NAME);
+ AttributeType type = DirectoryServer.getAttributeTypeOrNull(ATTRIBUTE_NAME);
attrInfo3.delete(Attributes.create(type, att), updateTime) ;
assertEquals(attrInfo3.getValuesHistorical().size(), 1);
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 370bcfa..47a96d5 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
@@ -548,7 +548,7 @@
debugInfo("Entry found <" + rootDn + ">");
AttributeType synchronizationGenIDType =
- DirectoryServer.getAttributeType(REPLICATION_GENERATION_ID);
+ DirectoryServer.getAttributeTypeOrNull(REPLICATION_GENERATION_ID);
List<Attribute> attrs =
resultEntry.getAttribute(synchronizationGenIDType);
if (attrs != null)
@@ -687,7 +687,7 @@
if (!first)
{
assertFalse(newEntry.hasAttribute(DirectoryServer.
- getAttributeType(fracAttr.toLowerCase())));
+ getAttributeTypeOrNull(fracAttr.toLowerCase())));
}
first = false;
}
@@ -705,7 +705,7 @@
first = false;
}
assertFalse(newEntry.hasAttribute(DirectoryServer.
- getAttributeType(OPTIONAL_ATTR.toLowerCase())));
+ getAttributeTypeOrNull(OPTIONAL_ATTR.toLowerCase())));
break;
default:
fail("Unexpected fractional mode.");
@@ -744,7 +744,7 @@
if (!first)
{
assertFalse(entry.hasAttribute(DirectoryServer.
- getAttributeType(fracAttr.toLowerCase())));
+ getAttributeTypeOrNull(fracAttr.toLowerCase())));
}
first = false;
}
@@ -762,7 +762,7 @@
first = false;
}
assertFalse(entry.hasAttribute(DirectoryServer.
- getAttributeType(OPTIONAL_ATTR.toLowerCase())));
+ getAttributeTypeOrNull(OPTIONAL_ATTR.toLowerCase())));
break;
default:
fail("Unexpected fractional mode.");
@@ -988,7 +988,7 @@
private Entry waitTillEntryHasSynchroAttribute(String entryDN)
throws Exception
{
- AttributeType synchroAttrType = DirectoryServer.getAttributeType(SYNCHRO_OPTIONAL_ATTR.toLowerCase());
+ AttributeType synchroAttrType = DirectoryServer.getAttributeTypeOrNull(SYNCHRO_OPTIONAL_ATTR.toLowerCase());
DN dn = DN.valueOf(entryDN);
Entry entry = null;
diff --git a/opendj-server-legacy/src/test/java/org/opends/server/replication/plugin/HistoricalCsnOrderingTest.java b/opendj-server-legacy/src/test/java/org/opends/server/replication/plugin/HistoricalCsnOrderingTest.java
index ef7469c..7cb488e 100644
--- a/opendj-server-legacy/src/test/java/org/opends/server/replication/plugin/HistoricalCsnOrderingTest.java
+++ b/opendj-server-legacy/src/test/java/org/opends/server/replication/plugin/HistoricalCsnOrderingTest.java
@@ -149,7 +149,7 @@
long startTime = TimeThread.getTime();
final DN dn1 = DN.valueOf("cn=test1," + baseDN);
final AttributeType histType =
- DirectoryServer.getAttributeType(EntryHistorical.HISTORICAL_ATTRIBUTE_NAME);
+ DirectoryServer.getAttributeTypeOrNull(EntryHistorical.HISTORICAL_ATTRIBUTE_NAME);
logger.error(LocalizableMessage.raw("Starting replication test : changesCmpTest"));
diff --git a/opendj-server-legacy/src/test/java/org/opends/server/replication/plugin/HistoricalTest.java b/opendj-server-legacy/src/test/java/org/opends/server/replication/plugin/HistoricalTest.java
index d5294b5..d59774f 100644
--- a/opendj-server-legacy/src/test/java/org/opends/server/replication/plugin/HistoricalTest.java
+++ b/opendj-server-legacy/src/test/java/org/opends/server/replication/plugin/HistoricalTest.java
@@ -233,10 +233,8 @@
final DN dn1 = DN.valueOf("cn=test1," + TEST_ROOT_DN_STRING);
final DN dn2 = DN.valueOf("cn=test2," + TEST_ROOT_DN_STRING);
final DN baseDN = DN.valueOf(TEST_ROOT_DN_STRING);
- final AttributeType attrType =
- DirectoryServer.getAttributeType("displayname");
- final AttributeType entryuuidType =
- DirectoryServer.getAttributeType("entryuuid");
+ final AttributeType attrType = DirectoryServer.getAttributeTypeOrNull("displayname");
+ final AttributeType entryuuidType = DirectoryServer.getAttributeTypeOrNull("entryuuid");
/*
* Open a session to the replicationServer using the broker API.
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 8a611ab..da1c83d 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
@@ -1077,7 +1077,7 @@
UUID uuid = UUID.randomUUID();
// Create the att values list
- AttributeType entryuuidAttrType = getAttributeType(ENTRYUUID_ATTRIBUTE_NAME);
+ AttributeType entryuuidAttrType = getAttributeTypeOrNull(ENTRYUUID_ATTRIBUTE_NAME);
List<Attribute> uuidList = Attributes.createAsList(entryuuidAttrType, uuid.toString());
// Add the uuid in the entry
@@ -1165,7 +1165,7 @@
*/
private void assertEntryHistoricalEncodingDecoding(Entry entry, EntryHistorical hist)
{
- entry.removeAttribute(getAttributeType(HISTORICAL_ATTRIBUTE_NAME));
+ entry.removeAttribute(getAttributeTypeOrNull(HISTORICAL_ATTRIBUTE_NAME));
entry.addAttribute(hist.encodeAndPurge(), null);
EntryHistorical hist2 = EntryHistorical.newInstanceFromEntry(entry);
assertEquals(hist2.encodeAndPurge(), hist.encodeAndPurge());
@@ -1197,7 +1197,7 @@
private void assertContainsOnlyValues(Entry entry, String attrName, String... expectedValues)
{
- Attribute attr = entry.getExactAttribute(getAttributeType(toLowerCase(attrName)), Collections.<String> emptySet());
+ Attribute attr = entry.getExactAttribute(getAttributeTypeOrNull(toLowerCase(attrName)), Collections.<String> emptySet());
assertThat(attr).hasSize(expectedValues.length);
for (String value : expectedValues)
{
@@ -1218,7 +1218,7 @@
private String getEntryUUID(Entry entry)
{
- AttributeType entryuuidAttrType = getAttributeType(ENTRYUUID_ATTRIBUTE_NAME);
+ AttributeType entryuuidAttrType = getAttributeTypeOrNull(ENTRYUUID_ATTRIBUTE_NAME);
List<Attribute> uuidAttrs = entry.getOperationalAttributes().get(entryuuidAttrType);
return uuidAttrs.get(0).iterator().next().toString();
}
diff --git a/opendj-server-legacy/src/test/java/org/opends/server/replication/protocol/ProtocolCompatibilityTest.java b/opendj-server-legacy/src/test/java/org/opends/server/replication/protocol/ProtocolCompatibilityTest.java
index 5f8c401..de428de 100644
--- a/opendj-server-legacy/src/test/java/org/opends/server/replication/protocol/ProtocolCompatibilityTest.java
+++ b/opendj-server-legacy/src/test/java/org/opends/server/replication/protocol/ProtocolCompatibilityTest.java
@@ -444,7 +444,7 @@
CSN csn1 = new CSN(1, 0, 1);
CSN csn2 = new CSN(TimeThread.getTime(), 123, 45);
- AttributeType type = DirectoryServer.getAttributeType("description");
+ AttributeType type = DirectoryServer.getAttributeTypeOrNull("description");
Attribute attr1 = Attributes.create("description", "new value");
Modification mod1 = new Modification(ModificationType.REPLACE, attr1);
@@ -620,7 +620,7 @@
@DataProvider(name = "createModifyDnData")
public Object[][] createModifyDnData() {
- AttributeType type = DirectoryServer.getAttributeType("description");
+ AttributeType type = DirectoryServer.getAttributeTypeOrNull("description");
Attribute attr1 = Attributes.create("description", "new value");
Modification mod1 = new Modification(ModificationType.REPLACE, attr1);
diff --git a/opendj-server-legacy/src/test/java/org/opends/server/replication/protocol/SynchronizationMsgTest.java b/opendj-server-legacy/src/test/java/org/opends/server/replication/protocol/SynchronizationMsgTest.java
index 103024b..8e4e981 100644
--- a/opendj-server-legacy/src/test/java/org/opends/server/replication/protocol/SynchronizationMsgTest.java
+++ b/opendj-server-legacy/src/test/java/org/opends/server/replication/protocol/SynchronizationMsgTest.java
@@ -87,7 +87,7 @@
CSN csn2 = new CSN(TimeThread.getTime(), 123, 45);
CSN csn3 = new CSN(TimeThread.getTime(), 67894123, 45678);
- AttributeType type = DirectoryServer.getAttributeType("description");
+ AttributeType type = DirectoryServer.getAttributeTypeOrNull("description");
Attribute attr1 = Attributes.create("description", "new value");
Modification mod1 = new Modification(ModificationType.REPLACE, attr1);
@@ -324,7 +324,7 @@
@DataProvider(name = "createModifyDnData")
public Object[][] createModifyDnData() {
- AttributeType type = DirectoryServer.getAttributeType("description");
+ AttributeType type = DirectoryServer.getAttributeTypeOrNull("description");
Attribute attr1 = Attributes.create("description", "new value");
Modification mod1 = new Modification(ModificationType.REPLACE, attr1);
diff --git a/opendj-server-legacy/src/test/java/org/opends/server/schema/GenericSchemaTestCase.java b/opendj-server-legacy/src/test/java/org/opends/server/schema/GenericSchemaTestCase.java
index 6345a49..92408a3 100644
--- a/opendj-server-legacy/src/test/java/org/opends/server/schema/GenericSchemaTestCase.java
+++ b/opendj-server-legacy/src/test/java/org/opends/server/schema/GenericSchemaTestCase.java
@@ -182,7 +182,7 @@
continue;
}
- AttributeType attrType = DirectoryServer.getAttributeType("attributetypes");
+ AttributeType attrType = DirectoryServer.getAttributeTypeOrNull("attributetypes");
assertNotNull(attrType);
List<Attribute> attrList = e.getAttribute(attrType);
if (attrList == null)
@@ -257,7 +257,7 @@
continue;
}
- AttributeType attrType = DirectoryServer.getAttributeType("objectclasses");
+ AttributeType attrType = DirectoryServer.getAttributeTypeOrNull("objectclasses");
assertNotNull(attrType);
List<Attribute> attrList = e.getAttribute(attrType);
if (attrList == null)
@@ -331,7 +331,7 @@
continue;
}
- AttributeType attrType = DirectoryServer.getAttributeType("nameforms");
+ AttributeType attrType = DirectoryServer.getAttributeTypeOrNull("nameforms");
assertNotNull(attrType);
List<Attribute> attrList = e.getAttribute(attrType);
if (attrList == null)
diff --git a/opendj-server-legacy/src/test/java/org/opends/server/types/AttributeBuilderTest.java b/opendj-server-legacy/src/test/java/org/opends/server/types/AttributeBuilderTest.java
index 64ca536..e8e9c2a 100644
--- a/opendj-server-legacy/src/test/java/org/opends/server/types/AttributeBuilderTest.java
+++ b/opendj-server-legacy/src/test/java/org/opends/server/types/AttributeBuilderTest.java
@@ -528,7 +528,7 @@
TestCaseUtils.startServer();
// Initialize the CN attribute type used in all tests.
- cnType = DirectoryServer.getAttributeType("cn");
+ cnType = DirectoryServer.getAttributeTypeOrNull("cn");
Assert.assertNotNull(cnType);
cnValue = ByteString.valueOf("john doe");
diff --git a/opendj-server-legacy/src/test/java/org/opends/server/types/EntrySchemaCheckingTestCase.java b/opendj-server-legacy/src/test/java/org/opends/server/types/EntrySchemaCheckingTestCase.java
index 16bc5a4..15f0740 100644
--- a/opendj-server-legacy/src/test/java/org/opends/server/types/EntrySchemaCheckingTestCase.java
+++ b/opendj-server-legacy/src/test/java/org/opends/server/types/EntrySchemaCheckingTestCase.java
@@ -445,16 +445,14 @@
public void testMultipleValuesForSingleValuedOperationalAttribute()
throws Exception
{
- // The LDIF reader won't let us do this directly, so we have to hack around
- // it.
+ // The LDIF reader won't let us do this directly, so we have to hack around it.
Entry e = TestCaseUtils.makeEntry(
"dn: dc=example,dc=com",
"objectClass: top",
"objectClass: domain",
"dc: example");
- AttributeType creatorsNameType =
- DirectoryServer.getAttributeType("creatorsname");
+ AttributeType creatorsNameType = DirectoryServer.getAttributeTypeOrNull("creatorsname");
assertTrue(creatorsNameType.isOperational());
AttributeBuilder builder = new AttributeBuilder(creatorsNameType,
diff --git a/opendj-server-legacy/src/test/java/org/opends/server/types/PrivilegeTestCase.java b/opendj-server-legacy/src/test/java/org/opends/server/types/PrivilegeTestCase.java
index e8ed910..6e20347 100644
--- a/opendj-server-legacy/src/test/java/org/opends/server/types/PrivilegeTestCase.java
+++ b/opendj-server-legacy/src/test/java/org/opends/server/types/PrivilegeTestCase.java
@@ -426,10 +426,9 @@
{
assertEquals(conn.hasPrivilege(Privilege.CONFIG_READ, null), hasPrivilege);
- CompareOperation compareOperation =
- conn.processCompare(DN.valueOf("cn=config"),
- DirectoryServer.getAttributeType("cn"),
- ByteString.valueOf("config"));
+ AttributeType cnAttrType = DirectoryServer.getAttributeTypeOrNull("cn");
+ CompareOperation compareOperation = conn.processCompare(
+ DN.valueOf("cn=config"), cnAttrType, ByteString.valueOf("config"));
if (hasPrivilege)
{
assertEquals(compareOperation.getResultCode(), COMPARE_TRUE);
diff --git a/opendj-server-legacy/src/test/java/org/opends/server/types/SearchFilterTests.java b/opendj-server-legacy/src/test/java/org/opends/server/types/SearchFilterTests.java
index 0d83a0e..516e396 100644
--- a/opendj-server-legacy/src/test/java/org/opends/server/types/SearchFilterTests.java
+++ b/opendj-server-legacy/src/test/java/org/opends/server/types/SearchFilterTests.java
@@ -577,7 +577,7 @@
FilterDescription description = new FilterDescription();
description.filterType = filterType;
- description.attributeType = DirectoryServer.getAttributeType(attributeType);
+ description.attributeType = DirectoryServer.getAttributeTypeOrNull(attributeType);
description.assertionValue = ByteString.valueOf(attributeValue);
if (filterType == FilterType.EQUALITY) {
@@ -639,7 +639,7 @@
FilterDescription description = new FilterDescription();
description.filterType = FilterType.SUBSTRING;
- description.attributeType = DirectoryServer.getAttributeType(attributeType);
+ description.attributeType = DirectoryServer.getAttributeTypeOrNull(attributeType);
description.subInitialElement = ByteString.valueOf(subInitial);
description.subAnyElements = new ArrayList<>();
diff --git a/opendj-server-legacy/src/test/java/org/opends/server/types/TestEntry.java b/opendj-server-legacy/src/test/java/org/opends/server/types/TestEntry.java
index b67cb28..f17eb4a 100644
--- a/opendj-server-legacy/src/test/java/org/opends/server/types/TestEntry.java
+++ b/opendj-server-legacy/src/test/java/org/opends/server/types/TestEntry.java
@@ -127,8 +127,8 @@
*/
@Test
public void testParseAttributeNotFound() throws Exception {
- AttributeType type1 = DirectoryServer.getAttributeType("description");
- AttributeType type2 = DirectoryServer.getAttributeType("inheritable");
+ AttributeType type1 = DirectoryServer.getAttributeTypeOrNull("description");
+ AttributeType type2 = DirectoryServer.getAttributeTypeOrNull("inheritable");
Entry entry = createTestEntry(type1, "hello world");
@@ -140,12 +140,11 @@
*/
@Test
public void testParseAttributeBooleanTrue() throws Exception {
- AttributeType type = DirectoryServer.getAttributeType("inheritable");
+ AttributeType type = DirectoryServer.getAttributeTypeOrNull("inheritable");
Entry entry = createTestEntry(type, "true");
- assertEquals(entry.parseAttribute(type.getNameOrOID()).asBoolean(),
- Boolean.TRUE);
+ assertEquals(entry.parseAttribute(type.getNameOrOID()).asBoolean(), Boolean.TRUE);
}
/**
@@ -154,12 +153,11 @@
@Test
public void testParseAttributeBooleanFalse() throws Exception
{
- AttributeType type = DirectoryServer.getAttributeType("inheritable");
+ AttributeType type = DirectoryServer.getAttributeTypeOrNull("inheritable");
Entry entry = createTestEntry(type, "false");
- assertEquals(entry.parseAttribute(type.getNameOrOID()).asBoolean(),
- Boolean.FALSE);
+ assertEquals(entry.parseAttribute(type.getNameOrOID()).asBoolean(), Boolean.FALSE);
}
/**
@@ -168,7 +166,7 @@
@Test(expectedExceptions = LocalizedIllegalArgumentException.class)
public void testParseAttributeBooleanBad() throws Exception
{
- AttributeType type = DirectoryServer.getAttributeType("inheritable");
+ AttributeType type = DirectoryServer.getAttributeTypeOrNull("inheritable");
Entry entry = createTestEntry(type, "bad-value");
entry.parseAttribute(type.getNameOrOID()).asBoolean();
@@ -185,8 +183,7 @@
@Test
public void testParseAttributesInteger() throws Exception
{
- AttributeType type = DirectoryServer
- .getAttributeType("supportedldapversion");
+ AttributeType type = DirectoryServer.getAttributeTypeOrNull("supportedldapversion");
String[] values = new String[] { "-4", "-2", "0", "1", "3" };
HashSet<Integer> expected = new HashSet<>();
@@ -209,8 +206,7 @@
@Test(expectedExceptions = LocalizedIllegalArgumentException.class)
public void testParseAttributeIntegerBad() throws Exception
{
- AttributeType type = DirectoryServer
- .getAttributeType("supportedldapversion");
+ AttributeType type = DirectoryServer.getAttributeTypeOrNull("supportedldapversion");
String[] values = new String[] { "-4", "-2", "xxx", "1", "3" };
Entry entry = createTestEntry(type, values);
@@ -292,11 +288,11 @@
assertTrue(e.conformsToSchema(null, false, false, false,
new LocalizableMessageBuilder()));
- AttributeType ocType = DirectoryServer.getAttributeType("objectclass");
- AttributeType cnType = DirectoryServer.getAttributeType("cn");
- AttributeType nameType = DirectoryServer.getAttributeType("name");
- AttributeType uidType = DirectoryServer.getAttributeType("uid");
- AttributeType mnType = DirectoryServer.getAttributeType("modifiersname");
+ AttributeType ocType = DirectoryServer.getAttributeTypeOrNull("objectclass");
+ AttributeType cnType = DirectoryServer.getAttributeTypeOrNull("cn");
+ AttributeType nameType = DirectoryServer.getAttributeTypeOrNull("name");
+ AttributeType uidType = DirectoryServer.getAttributeTypeOrNull("uid");
+ AttributeType mnType = DirectoryServer.getAttributeTypeOrNull("modifiersname");
assertTrue(e.hasAttribute(ocType));
assertTrue(e.hasAttribute(cnType));
@@ -380,11 +376,11 @@
assertTrue(e.conformsToSchema(null, false, false, false,
new LocalizableMessageBuilder()));
- AttributeType ocType = DirectoryServer.getAttributeType("objectclass");
- AttributeType cnType = DirectoryServer.getAttributeType("cn");
- AttributeType nameType = DirectoryServer.getAttributeType("name");
- AttributeType uidType = DirectoryServer.getAttributeType("uid");
- AttributeType mnType = DirectoryServer.getAttributeType("modifiersname");
+ AttributeType ocType = DirectoryServer.getAttributeTypeOrNull("objectclass");
+ AttributeType cnType = DirectoryServer.getAttributeTypeOrNull("cn");
+ AttributeType nameType = DirectoryServer.getAttributeTypeOrNull("name");
+ AttributeType uidType = DirectoryServer.getAttributeTypeOrNull("uid");
+ AttributeType mnType = DirectoryServer.getAttributeTypeOrNull("modifiersname");
assertFalse(e.hasUserAttribute(ocType));
assertTrue(e.hasUserAttribute(cnType));
@@ -426,11 +422,11 @@
assertTrue(e.conformsToSchema(null, false, false, false,
new LocalizableMessageBuilder()));
- AttributeType ocType = DirectoryServer.getAttributeType("objectclass");
- AttributeType cnType = DirectoryServer.getAttributeType("cn");
- AttributeType nameType = DirectoryServer.getAttributeType("name");
- AttributeType uidType = DirectoryServer.getAttributeType("uid");
- AttributeType mnType = DirectoryServer.getAttributeType("modifiersname");
+ AttributeType ocType = DirectoryServer.getAttributeTypeOrNull("objectclass");
+ AttributeType cnType = DirectoryServer.getAttributeTypeOrNull("cn");
+ AttributeType nameType = DirectoryServer.getAttributeTypeOrNull("name");
+ AttributeType uidType = DirectoryServer.getAttributeTypeOrNull("uid");
+ AttributeType mnType = DirectoryServer.getAttributeTypeOrNull("modifiersname");
assertFalse(e.hasOperationalAttribute(ocType));
assertFalse(e.hasOperationalAttribute(cnType));
@@ -472,11 +468,11 @@
assertTrue(e.conformsToSchema(null, false, false, false,
new LocalizableMessageBuilder()));
- AttributeType ocType = DirectoryServer.getAttributeType("objectclass");
- AttributeType cnType = DirectoryServer.getAttributeType("cn");
- AttributeType nameType = DirectoryServer.getAttributeType("name");
- AttributeType uidType = DirectoryServer.getAttributeType("uid");
- AttributeType mnType = DirectoryServer.getAttributeType("modifiersname");
+ AttributeType ocType = DirectoryServer.getAttributeTypeOrNull("objectclass");
+ AttributeType cnType = DirectoryServer.getAttributeTypeOrNull("cn");
+ AttributeType nameType = DirectoryServer.getAttributeTypeOrNull("name");
+ AttributeType uidType = DirectoryServer.getAttributeTypeOrNull("uid");
+ AttributeType mnType = DirectoryServer.getAttributeTypeOrNull("modifiersname");
List<Attribute> attrs = e.getAttribute(ocType);
assertNotNull(attrs);
@@ -727,11 +723,11 @@
assertTrue(e.conformsToSchema(null, false, false, false,
new LocalizableMessageBuilder()));
- AttributeType ocType = DirectoryServer.getAttributeType("objectclass");
- AttributeType cnType = DirectoryServer.getAttributeType("cn");
- AttributeType nameType = DirectoryServer.getAttributeType("name");
- AttributeType uidType = DirectoryServer.getAttributeType("uid");
- AttributeType mnType = DirectoryServer.getAttributeType("modifiersname");
+ AttributeType ocType = DirectoryServer.getAttributeTypeOrNull("objectclass");
+ AttributeType cnType = DirectoryServer.getAttributeTypeOrNull("cn");
+ AttributeType nameType = DirectoryServer.getAttributeTypeOrNull("name");
+ AttributeType uidType = DirectoryServer.getAttributeTypeOrNull("uid");
+ AttributeType mnType = DirectoryServer.getAttributeTypeOrNull("modifiersname");
List<Attribute> attrs = e.getUserAttribute(ocType);
assertNull(attrs);
@@ -876,11 +872,11 @@
assertTrue(e.conformsToSchema(null, false, false, false,
new LocalizableMessageBuilder()));
- AttributeType ocType = DirectoryServer.getAttributeType("objectclass");
- AttributeType cnType = DirectoryServer.getAttributeType("cn");
- AttributeType nameType = DirectoryServer.getAttributeType("name");
- AttributeType uidType = DirectoryServer.getAttributeType("uid");
- AttributeType mnType = DirectoryServer.getAttributeType("modifiersname");
+ AttributeType ocType = DirectoryServer.getAttributeTypeOrNull("objectclass");
+ AttributeType cnType = DirectoryServer.getAttributeTypeOrNull("cn");
+ AttributeType nameType = DirectoryServer.getAttributeTypeOrNull("name");
+ AttributeType uidType = DirectoryServer.getAttributeTypeOrNull("uid");
+ AttributeType mnType = DirectoryServer.getAttributeTypeOrNull("modifiersname");
List<Attribute> attrs = e.getOperationalAttribute(ocType);
assertNull(attrs);
diff --git a/opendj-server-legacy/src/test/java/org/opends/server/types/TestRDN.java b/opendj-server-legacy/src/test/java/org/opends/server/types/TestRDN.java
index 4356c6a..ac299f9 100644
--- a/opendj-server-legacy/src/test/java/org/opends/server/types/TestRDN.java
+++ b/opendj-server-legacy/src/test/java/org/opends/server/types/TestRDN.java
@@ -67,8 +67,8 @@
// we'll start the server.
TestCaseUtils.startServer();
- AT_DC = DirectoryServer.getAttributeType("dc");
- AT_CN = DirectoryServer.getAttributeType("cn");
+ AT_DC = DirectoryServer.getAttributeTypeOrNull("dc");
+ AT_CN = DirectoryServer.getAttributeTypeOrNull("cn");
AttributeType dummy = DirectoryServer.getDefaultAttributeType(
"x-test-integer-type", DirectoryServer
diff --git a/opendj-server-legacy/src/test/java/org/opends/server/types/VirtualAttributeRuleTestCase.java b/opendj-server-legacy/src/test/java/org/opends/server/types/VirtualAttributeRuleTestCase.java
index 258593e..a953d36 100644
--- a/opendj-server-legacy/src/test/java/org/opends/server/types/VirtualAttributeRuleTestCase.java
+++ b/opendj-server-legacy/src/test/java/org/opends/server/types/VirtualAttributeRuleTestCase.java
@@ -66,7 +66,7 @@
{
TestCaseUtils.startServer();
- entryDNType = DirectoryServer.getAttributeType("entrydn");
+ entryDNType = DirectoryServer.getAttributeTypeOrNull("entrydn");
assertNotNull(entryDNType);
}
diff --git a/opendj-server-legacy/src/test/java/org/opends/server/types/VirtualAttributeTestCase.java b/opendj-server-legacy/src/test/java/org/opends/server/types/VirtualAttributeTestCase.java
index fa95cc3..40947ee 100644
--- a/opendj-server-legacy/src/test/java/org/opends/server/types/VirtualAttributeTestCase.java
+++ b/opendj-server-legacy/src/test/java/org/opends/server/types/VirtualAttributeTestCase.java
@@ -69,7 +69,7 @@
{
TestCaseUtils.startServer();
- entryDNType = DirectoryServer.getAttributeType("entrydn");
+ entryDNType = DirectoryServer.getAttributeTypeOrNull("entrydn");
assertNotNull(entryDNType);
EntryDNVirtualAttributeProvider provider =
diff --git a/opendj-server-legacy/src/test/java/org/opends/server/util/TestLDIFReader.java b/opendj-server-legacy/src/test/java/org/opends/server/util/TestLDIFReader.java
index db63972..fd05551 100644
--- a/opendj-server-legacy/src/test/java/org/opends/server/util/TestLDIFReader.java
+++ b/opendj-server-legacy/src/test/java/org/opends/server/util/TestLDIFReader.java
@@ -176,10 +176,10 @@
OC_PERSON = DirectoryServer.getObjectClass("person");
AT_OC = DirectoryServer.getObjectClassAttributeType();
- AT_CN = DirectoryServer.getAttributeType("cn");
- AT_SN = DirectoryServer.getAttributeType("sn");
- AT_DESCR = DirectoryServer.getAttributeType("description");
- AT_TELN = DirectoryServer.getAttributeType("telephonenumber");
+ AT_CN = DirectoryServer.getAttributeTypeOrNull("cn");
+ AT_SN = DirectoryServer.getAttributeTypeOrNull("sn");
+ AT_DESCR = DirectoryServer.getAttributeTypeOrNull("description");
+ AT_TELN = DirectoryServer.getAttributeTypeOrNull("telephonenumber");
// Create a temporary file containing an attribute value.
TEMP_FILE = File.createTempFile("tmp", "txt");
@@ -551,18 +551,15 @@
Assert.assertTrue(change instanceof ModifyChangeRecordEntry);
modify = (ModifyChangeRecordEntry) change;
- dn = DN
- .valueOf("cn=Ingrid Jensen, ou=Product Support, dc=airius, dc=com");
+ dn = DN.valueOf("cn=Ingrid Jensen, ou=Product Support, dc=airius, dc=com");
Assert.assertEquals(modify.getDN(), dn);
i = modify.getModifications().iterator();
Assert.assertTrue(i.hasNext());
mod = i.next().toModification();
- Assert.assertEquals(mod.getModificationType(),
- ModificationType.REPLACE);
- attr = Attributes.empty(DirectoryServer
- .getAttributeType("postaladdress"));
+ Assert.assertEquals(mod.getModificationType(), ModificationType.REPLACE);
+ attr = Attributes.empty(DirectoryServer.getAttributeTypeOrNull("postaladdress"));
Assert.assertEquals(mod.getAttribute(), attr);
// Change record #7.
--
Gitblit v1.10.0