From 8643a9160860e31611f034467f702eb3a712eb34 Mon Sep 17 00:00:00 2001
From: Nicolas Capponi <nicolas.capponi@forgerock.com>
Date: Wed, 08 Jan 2014 14:33:23 +0000
Subject: [PATCH] Replace org.opends.server.util.Validator class by org.forgerock.util.Reject class from forgerock-util module
---
opendj3-server-dev/src/server/org/opends/server/admin/SizePropertyDefinition.java | 9
opendj3-server-dev/src/server/org/opends/server/types/DITContentRule.java | 10
opendj3-server-dev/src/server/org/opends/server/admin/BooleanPropertyDefinition.java | 7
opendj3-server-dev/src/server/org/opends/server/backends/LDIFBackend.java | 3
opendj3-server-dev/src/server/org/opends/server/types/AuthenticationInfo.java | 8
opendj3-server-dev/tests/unit-tests-testng/src/server/org/opends/server/extensions/SimilarityBasedPasswordValidatorTestCase.java | 2
opendj3-server-dev/tests/unit-tests-testng/src/server/org/opends/server/admin/BooleanPropertyDefinitionTest.java | 7
opendj3-server-dev/src/server/org/opends/server/tools/dsconfig/PropertyValueEditor.java | 8
opendj3-server-dev/tests/unit-tests-testng/src/server/org/opends/server/admin/EnumPropertyDefinitionTest.java | 3
opendj3-server-dev/src/server/org/opends/server/admin/StringPropertyDefinition.java | 9
opendj3-server-dev/src/server/org/opends/server/util/LDIFWriter.java | 24
opendj3-server-dev/src/server/org/opends/server/admin/DNPropertyDefinition.java | 6
opendj3-server-dev/src/server/org/opends/server/admin/EnumPropertyDefinition.java | 9
opendj3-server-dev/src/server/org/opends/server/backends/jeb/BackendImpl.java | 6
opendj3-server-dev/src/server/org/opends/server/util/StaticUtils.java | 5
opendj3-server-dev/src/server/org/opends/server/types/CommonSchemaElements.java | 8
opendj3-server-dev/src/server/org/opends/server/core/BaseDnRegistry.java | 4
opendj3-server-dev/src/server/org/opends/server/types/AttributeType.java | 6
opendj3-server-dev/src/server/org/opends/server/util/LDIFReader.java | 6
opendj3-server-dev/src/server/org/opends/server/extensions/SimpleStaticGroupMemberList.java | 6
opendj3-server-dev/src/server/org/opends/server/admin/AggregationPropertyDefinition.java | 5
opendj3-server-dev/src/server/org/opends/server/admin/IPAddressPropertyDefinition.java | 7
opendj3-server-dev/src/server/org/opends/server/extensions/DynamicGroup.java | 8
opendj3-server-dev/src/server/org/opends/server/workflowelement/localbackend/LocalBackendModifyOperation.java | 4
opendj3-server-dev/src/server/org/opends/server/extensions/VirtualStaticGroup.java | 8
opendj3-server-dev/src/server/org/opends/server/admin/RelationDefinition.java | 5
opendj3-server-dev/src/server/org/opends/server/types/ResultCode.java | 5
opendj3-server-dev/src/server/org/opends/server/core/WorkflowImpl.java | 7
opendj3-server-dev/src/server/org/opends/server/types/VirtualAttributeRule.java | 6
opendj3-server-dev/src/server/org/opends/server/util/AddChangeRecordEntry.java | 5
opendj3-server-dev/src/server/org/opends/server/util/Base64.java | 9
opendj3-server-dev/tests/unit-tests-testng/src/server/org/opends/server/controls/ProxiedAuthV2ControlTestCase.java | 2
opendj3-server-dev/src/server/org/opends/server/core/networkgroups/NetworkGroup.java | 8
opendj3-server-dev/src/server/org/opends/server/util/ModifyChangeRecordEntry.java | 5
opendj3-server-dev/src/server/org/opends/server/backends/MonitorBackend.java | 6
opendj3-server-dev/src/server/org/opends/server/controls/ProxiedAuthV2Control.java | 4
opendj3-server-dev/src/server/org/opends/server/admin/condition/ORCondition.java | 5
opendj3-server-dev/src/server/org/opends/server/admin/DurationPropertyDefinition.java | 13
opendj3-server-dev/src/server/org/opends/server/types/AdditionalLogItem.java | 10
opendj3-server-dev/src/server/org/opends/server/types/ObjectClass.java | 6
opendj3-server-dev/src/server/org/opends/server/backends/task/TaskBackend.java | 5
opendj3-server-dev/src/server/org/opends/server/extensions/StaticGroup.java | 16
opendj3-server-dev/src/server/org/opends/server/admin/condition/IsPresentCondition.java | 5
opendj3-server-dev/src/server/org/opends/server/controls/MatchedValuesFilter.java | 32 +-
opendj3-server-dev/src/server/org/opends/server/types/NameForm.java | 10
opendj3-server-dev/src/server/org/opends/server/admin/client/OperationRejectedException.java | 7
opendj3-server-dev/src/server/org/opends/server/backends/MemoryBackend.java | 4
opendj3-server-dev/tests/unit-tests-testng/src/server/org/opends/server/admin/client/ldap/CreateEntryMockLDAPConnection.java | 9
opendj3-server-dev/src/server/org/opends/server/types/MatchingRuleUse.java | 10
opendj3-server-dev/src/server/org/opends/server/authorization/dseecompat/PatternDN.java | 4
opendj3-server-dev/src/server/org/opends/server/admin/PropertyDefinition.java | 19
opendj3-server-dev/src/server/org/opends/server/types/AbstractOperation.java | 4
opendj3-server-dev/src/server/org/opends/server/admin/ClassLoaderProvider.java | 6
opendj3-server-dev/src/server/org/opends/server/types/LDAPSyntaxDescription.java | 10
opendj3-server-dev/src/server/org/opends/server/admin/AttributeTypePropertyDefinition.java | 7
opendj3-server-dev/src/server/org/opends/server/admin/condition/NOTCondition.java | 5
opendj3-server-dev/src/server/org/opends/server/types/DN.java | 4
opendj3-server-dev/src/server/org/opends/server/admin/condition/ContainsCondition.java | 5
opendj3-server-dev/src/server/org/opends/server/admin/Tag.java | 5
opendj3-server-dev/src/server/org/opends/server/admin/ClassPropertyDefinition.java | 14
opendj3-server-dev/src/server/org/opends/server/crypto/CryptoManagerImpl.java | 36 +-
opendj3-server-dev/src/server/org/opends/server/replication/server/ReplicationBackend.java | 3
opendj3-server-dev/src/server/org/opends/server/schema/StringPrepProfile.java | 7
opendj3-server-dev/src/server/org/opends/server/util/ChangeRecordEntry.java | 5
opendj3-server-dev/src/server/org/opends/server/util/LevenshteinDistance.java | 5
opendj3-server-dev/src/server/org/opends/server/backends/RootDSEBackend.java | 6
opendj3-server-dev/src/server/org/opends/server/extensions/FilteredStaticGroupMemberList.java | 4
opendj3-server-dev/src/server/org/opends/server/admin/client/ManagedObjectDecodingException.java | 7
opendj3-server-dev/src/server/org/opends/server/admin/server/ServerManagedObjectDecodingException.java | 7
opendj3-server-dev/src/server/org/opends/server/types/AttributeBuilder.java | 10
opendj3-server-dev/src/server/org/opends/server/admin/condition/ANDCondition.java | 5
opendj3-server-dev/src/server/org/opends/server/backends/jeb/DataConfig.java | 7
opendj3-server-dev/tests/unit-tests-testng/src/server/org/opends/server/admin/client/ldap/ModifyEntryMockLDAPConnection.java | 7
opendj3-server-dev/src/server/org/opends/server/admin/ACIPropertyDefinition.java | 7
opendj3-server-dev/src/server/org/opends/server/backends/SchemaBackend.java | 4
opendj3-server-dev/src/server/org/opends/server/types/RawAttribute.java | 14
opendj3-server-dev/src/server/org/opends/server/admin/IPAddressMaskPropertyDefinition.java | 7
opendj3-server-dev/src/server/org/opends/server/backends/NullBackend.java | 5
opendj3-server-dev/src/server/org/opends/server/core/DirectoryServer.java | 41 +-
/dev/null | 168 -----------
opendj3-server-dev/src/server/org/opends/server/admin/InstantiableRelationDefinition.java | 5
opendj3-server-dev/src/server/org/opends/server/types/DITStructureRule.java | 10
opendj3-server-dev/src/server/org/opends/server/admin/client/ldap/LDAPManagementContext.java | 5
opendj3-server-dev/src/server/org/opends/server/admin/client/MissingMandatoryPropertiesException.java | 7
opendj3-server-dev/src/server/org/opends/server/backends/BackupBackend.java | 4
opendj3-server-dev/src/server/org/opends/server/util/ModifyDNChangeRecordEntry.java | 5
opendj3-server-dev/tests/unit-tests-testng/src/server/org/opends/server/util/LevenshteinDistanceTestCase.java | 5
opendj3-server-dev/src/server/org/opends/server/admin/IntegerPropertyDefinition.java | 9
opendj3-server-dev/src/server/org/opends/server/util/MultiOutputStream.java | 5
opendj3-server-dev/src/server/org/opends/server/backends/TrustStoreBackend.java | 6
opendj3-server-dev/src/server/org/opends/server/admin/server/ConstraintViolationException.java | 7
91 files changed, 380 insertions(+), 498 deletions(-)
diff --git a/opendj3-server-dev/src/server/org/opends/server/admin/ACIPropertyDefinition.java b/opendj3-server-dev/src/server/org/opends/server/admin/ACIPropertyDefinition.java
index 958af8b..d567430 100644
--- a/opendj3-server-dev/src/server/org/opends/server/admin/ACIPropertyDefinition.java
+++ b/opendj3-server-dev/src/server/org/opends/server/admin/ACIPropertyDefinition.java
@@ -22,6 +22,7 @@
*
*
* Copyright 2008 Sun Microsystems, Inc.
+ * Portions Copyright 2014 ForgeRock AS
*/
package org.opends.server.admin;
@@ -30,7 +31,7 @@
import org.opends.server.authorization.dseecompat.AciException;
import org.opends.server.types.DN;
import org.opends.server.types.ByteString;
-import static org.opends.server.util.Validator.ensureNotNull;
+import static org.forgerock.util.Reject.ifNull;
import java.util.EnumSet;
@@ -101,7 +102,7 @@
@Override
public void validateValue(Aci value)
throws IllegalPropertyValueException {
- ensureNotNull(value);
+ ifNull(value);
// No additional validation required.
}
@@ -112,7 +113,7 @@
@Override
public Aci decodeValue(String value)
throws IllegalPropertyValueStringException {
- ensureNotNull(value);
+ ifNull(value);
try {
return Aci.decode(ByteString.valueOf(value), DN.NULL_DN);
diff --git a/opendj3-server-dev/src/server/org/opends/server/admin/AggregationPropertyDefinition.java b/opendj3-server-dev/src/server/org/opends/server/admin/AggregationPropertyDefinition.java
index 3641f87..4329bce 100644
--- a/opendj3-server-dev/src/server/org/opends/server/admin/AggregationPropertyDefinition.java
+++ b/opendj3-server-dev/src/server/org/opends/server/admin/AggregationPropertyDefinition.java
@@ -22,6 +22,7 @@
*
*
* Copyright 2007-2008 Sun Microsystems, Inc.
+ * Portions Copyright 2014 ForgeRock AS
*/
package org.opends.server.admin;
@@ -29,7 +30,7 @@
import static org.opends.messages.AdminMessages.*;
import static org.opends.server.loggers.debug.DebugLogger.*;
-import static org.opends.server.util.Validator.*;
+import static org.forgerock.util.Reject.*;
import java.util.Collection;
import java.util.Collections;
@@ -945,7 +946,7 @@
@Override
public String decodeValue(String value)
throws IllegalPropertyValueStringException {
- ensureNotNull(value);
+ ifNull(value);
try {
validateValue(value);
diff --git a/opendj3-server-dev/src/server/org/opends/server/admin/AttributeTypePropertyDefinition.java b/opendj3-server-dev/src/server/org/opends/server/admin/AttributeTypePropertyDefinition.java
index c79df74..b29289e 100644
--- a/opendj3-server-dev/src/server/org/opends/server/admin/AttributeTypePropertyDefinition.java
+++ b/opendj3-server-dev/src/server/org/opends/server/admin/AttributeTypePropertyDefinition.java
@@ -22,13 +22,14 @@
*
*
* Copyright 2008 Sun Microsystems, Inc.
+ * Portions Copyright 2014 ForgeRock AS
*/
package org.opends.server.admin;
-import static org.opends.server.util.Validator.ensureNotNull;
+import static org.forgerock.util.Reject.ifNull;
import java.util.EnumSet;
@@ -174,7 +175,7 @@
@Override
public AttributeType decodeValue(String value)
throws IllegalPropertyValueStringException {
- ensureNotNull(value);
+ ifNull(value);
String name = value.trim().toLowerCase();
AttributeType type = DirectoryServer.getAttributeType(name,
@@ -211,7 +212,7 @@
@Override
public void validateValue(AttributeType value)
throws IllegalPropertyValueException {
- ensureNotNull(value);
+ ifNull(value);
// No implementation required.
}
diff --git a/opendj3-server-dev/src/server/org/opends/server/admin/BooleanPropertyDefinition.java b/opendj3-server-dev/src/server/org/opends/server/admin/BooleanPropertyDefinition.java
index 1209b8d..5e5769c 100644
--- a/opendj3-server-dev/src/server/org/opends/server/admin/BooleanPropertyDefinition.java
+++ b/opendj3-server-dev/src/server/org/opends/server/admin/BooleanPropertyDefinition.java
@@ -22,13 +22,14 @@
*
*
* Copyright 2008 Sun Microsystems, Inc.
+ * Portions Copyright 2014 ForgeRock AS
*/
package org.opends.server.admin;
-import static org.opends.server.util.Validator.ensureNotNull;
+import static org.forgerock.util.Reject.ifNull;
import java.util.EnumSet;
import java.util.HashMap;
@@ -124,7 +125,7 @@
@Override
public void validateValue(Boolean value)
throws IllegalPropertyValueException {
- ensureNotNull(value);
+ ifNull(value);
// No additional validation required.
}
@@ -137,7 +138,7 @@
@Override
public Boolean decodeValue(String value)
throws IllegalPropertyValueStringException {
- ensureNotNull(value);
+ ifNull(value);
String nvalue = value.trim().toLowerCase();
Boolean b = VALUE_MAP.get(nvalue);
diff --git a/opendj3-server-dev/src/server/org/opends/server/admin/ClassLoaderProvider.java b/opendj3-server-dev/src/server/org/opends/server/admin/ClassLoaderProvider.java
index d2c4baa..b30973b 100644
--- a/opendj3-server-dev/src/server/org/opends/server/admin/ClassLoaderProvider.java
+++ b/opendj3-server-dev/src/server/org/opends/server/admin/ClassLoaderProvider.java
@@ -22,7 +22,7 @@
*
*
* Copyright 2008-2009 Sun Microsystems, Inc.
- * Portions copyright 2012 ForgeRock AS.
+ * Portions Copyright 2012-2014 ForgeRock AS.
*/
package org.opends.server.admin;
@@ -63,7 +63,7 @@
import org.opends.server.loggers.debug.DebugTracer;
import org.opends.server.types.DebugLogLevel;
import org.opends.server.types.InitializationException;
-import org.opends.server.util.Validator;
+import org.forgerock.util.Reject;
@@ -215,7 +215,7 @@
public synchronized void addExtension(String... extensions)
throws InitializationException, IllegalStateException,
IllegalArgumentException {
- Validator.ensureNotNull(extensions);
+ Reject.ifNull(extensions);
if (loader == null) {
throw new IllegalStateException(
diff --git a/opendj3-server-dev/src/server/org/opends/server/admin/ClassPropertyDefinition.java b/opendj3-server-dev/src/server/org/opends/server/admin/ClassPropertyDefinition.java
index 5f7c366..41aa111 100644
--- a/opendj3-server-dev/src/server/org/opends/server/admin/ClassPropertyDefinition.java
+++ b/opendj3-server-dev/src/server/org/opends/server/admin/ClassPropertyDefinition.java
@@ -22,14 +22,14 @@
*
*
* Copyright 2008 Sun Microsystems, Inc.
- * Portions copyright 2013 ForgeRock AS.
+ * Portions Copyright 2013-2014 ForgeRock AS.
*/
package org.opends.server.admin;
-import static org.opends.server.util.Validator.ensureNotNull;
+import static org.forgerock.util.Reject.ifNull;
import java.util.Collections;
import java.util.EnumSet;
@@ -84,7 +84,7 @@
* implement.
*/
public final void addInstanceOf(String className) {
- ensureNotNull(className);
+ ifNull(className);
/*
* Do some basic checks to make sure the string representation is valid.
@@ -245,7 +245,7 @@
@Override
public String decodeValue(String value)
throws IllegalPropertyValueStringException {
- ensureNotNull(value);
+ ifNull(value);
try {
validateValue(value);
@@ -293,7 +293,7 @@
public <T> Class<? extends T> loadClass(String className,
Class<T> instanceOf) throws IllegalPropertyValueException,
ClassCastException {
- ensureNotNull(className, instanceOf);
+ ifNull(className, instanceOf);
// Make sure that the named class is valid.
validateClassName(className);
@@ -311,7 +311,7 @@
@Override
public String normalizeValue(String value)
throws IllegalPropertyValueException {
- ensureNotNull(value);
+ ifNull(value);
return value.trim();
}
@@ -324,7 +324,7 @@
@Override
public void validateValue(String value)
throws IllegalPropertyValueException {
- ensureNotNull(value);
+ ifNull(value);
// Always make sure the name is a valid class name.
validateClassName(value);
diff --git a/opendj3-server-dev/src/server/org/opends/server/admin/DNPropertyDefinition.java b/opendj3-server-dev/src/server/org/opends/server/admin/DNPropertyDefinition.java
index 891d388..51b2d52 100644
--- a/opendj3-server-dev/src/server/org/opends/server/admin/DNPropertyDefinition.java
+++ b/opendj3-server-dev/src/server/org/opends/server/admin/DNPropertyDefinition.java
@@ -29,7 +29,7 @@
-import static org.opends.server.util.Validator.ensureNotNull;
+import static org.forgerock.util.Reject.ifNull;
import java.util.EnumSet;
@@ -172,7 +172,7 @@
@Override
public void validateValue(DN value)
throws IllegalPropertyValueException {
- ensureNotNull(value);
+ ifNull(value);
if (baseDN != null) {
DN parent = value.parent();
@@ -195,7 +195,7 @@
@Override
public DN decodeValue(String value)
throws IllegalPropertyValueStringException {
- ensureNotNull(value);
+ ifNull(value);
try {
DN dn = DN.valueOf(value);
diff --git a/opendj3-server-dev/src/server/org/opends/server/admin/DurationPropertyDefinition.java b/opendj3-server-dev/src/server/org/opends/server/admin/DurationPropertyDefinition.java
index 64e3492..de31ee6 100644
--- a/opendj3-server-dev/src/server/org/opends/server/admin/DurationPropertyDefinition.java
+++ b/opendj3-server-dev/src/server/org/opends/server/admin/DurationPropertyDefinition.java
@@ -22,13 +22,14 @@
*
*
* Copyright 2008 Sun Microsystems, Inc.
+ * Portions Copyright 2014 ForgeRock AS
*/
package org.opends.server.admin;
-import static org.opends.server.util.Validator.*;
+import static org.forgerock.util.Reject.*;
import java.util.EnumSet;
@@ -135,7 +136,7 @@
* than the maximum unit.
*/
public final void setBaseUnit(String unit) throws IllegalArgumentException {
- ensureNotNull(unit);
+ ifNull(unit);
setBaseUnit(DurationUnit.getUnit(unit));
}
@@ -155,7 +156,7 @@
*/
public final void setBaseUnit(DurationUnit unit)
throws IllegalArgumentException {
- ensureNotNull(unit);
+ ifNull(unit);
// Make sure that the base unit is not bigger than the maximum
// unit.
@@ -462,7 +463,7 @@
*/
@Override
public void validateValue(Long value) throws IllegalPropertyValueException {
- ensureNotNull(value);
+ ifNull(value);
long nvalue = baseUnit.toMilliSeconds(value);
if (!allowUnlimited && nvalue < lowerLimit) {
@@ -485,7 +486,7 @@
*/
@Override
public String encodeValue(Long value) throws IllegalPropertyValueException {
- ensureNotNull(value);
+ ifNull(value);
// Make sure that we correctly encode negative values as
// "unlimited".
@@ -511,7 +512,7 @@
@Override
public Long decodeValue(String value)
throws IllegalPropertyValueStringException {
- ensureNotNull(value);
+ ifNull(value);
// First check for the special "unlimited" value when necessary.
if (allowUnlimited) {
diff --git a/opendj3-server-dev/src/server/org/opends/server/admin/EnumPropertyDefinition.java b/opendj3-server-dev/src/server/org/opends/server/admin/EnumPropertyDefinition.java
index f5760e5..d7664c3 100644
--- a/opendj3-server-dev/src/server/org/opends/server/admin/EnumPropertyDefinition.java
+++ b/opendj3-server-dev/src/server/org/opends/server/admin/EnumPropertyDefinition.java
@@ -22,6 +22,7 @@
*
*
* Copyright 2008 Sun Microsystems, Inc.
+ * Portions Copyright 2014 ForgeRock AS
*/
package org.opends.server.admin;
@@ -29,7 +30,7 @@
-import static org.opends.server.util.Validator.ensureNotNull;
+import static org.forgerock.util.Reject.ifNull;
import java.util.EnumSet;
import java.util.HashMap;
@@ -179,7 +180,7 @@
@Override
public E decodeValue(String value)
throws IllegalPropertyValueStringException {
- ensureNotNull(value);
+ ifNull(value);
String nvalue = value.trim().toLowerCase();
E eValue = decodeMap.get(nvalue);
@@ -254,7 +255,7 @@
@Override
public String normalizeValue(E value)
throws IllegalPropertyValueException {
- ensureNotNull(value);
+ ifNull(value);
return value.toString().trim().toLowerCase();
}
@@ -267,7 +268,7 @@
@Override
public void validateValue(E value)
throws IllegalPropertyValueException {
- ensureNotNull(value);
+ ifNull(value);
// No additional validation required.
}
diff --git a/opendj3-server-dev/src/server/org/opends/server/admin/IPAddressMaskPropertyDefinition.java b/opendj3-server-dev/src/server/org/opends/server/admin/IPAddressMaskPropertyDefinition.java
index d1ececc..fafc29c 100644
--- a/opendj3-server-dev/src/server/org/opends/server/admin/IPAddressMaskPropertyDefinition.java
+++ b/opendj3-server-dev/src/server/org/opends/server/admin/IPAddressMaskPropertyDefinition.java
@@ -22,13 +22,14 @@
*
*
* Copyright 2008 Sun Microsystems, Inc.
+ * Portions Copyright 2014 ForgeRock AS
*/
package org.opends.server.admin;
-import static org.opends.server.util.Validator.ensureNotNull;
+import static org.forgerock.util.Reject.ifNull;
import java.util.EnumSet;
@@ -110,7 +111,7 @@
@Override
public void validateValue(AddressMask value)
throws IllegalPropertyValueException {
- ensureNotNull(value);
+ ifNull(value);
// No additional validation required.
}
@@ -123,7 +124,7 @@
@Override
public AddressMask decodeValue(String value)
throws IllegalPropertyValueStringException {
- ensureNotNull(value);
+ ifNull(value);
try {
return AddressMask.decode(value);
diff --git a/opendj3-server-dev/src/server/org/opends/server/admin/IPAddressPropertyDefinition.java b/opendj3-server-dev/src/server/org/opends/server/admin/IPAddressPropertyDefinition.java
index bfe5e43..486b0d6 100644
--- a/opendj3-server-dev/src/server/org/opends/server/admin/IPAddressPropertyDefinition.java
+++ b/opendj3-server-dev/src/server/org/opends/server/admin/IPAddressPropertyDefinition.java
@@ -22,13 +22,14 @@
*
*
* Copyright 2008 Sun Microsystems, Inc.
+ * Portions Copyright 2014 ForgeRock AS
*/
package org.opends.server.admin;
-import static org.opends.server.util.Validator.ensureNotNull;
+import static org.forgerock.util.Reject.ifNull;
import java.net.InetAddress;
import java.net.UnknownHostException;
@@ -109,7 +110,7 @@
@Override
public void validateValue(InetAddress value)
throws IllegalPropertyValueException {
- ensureNotNull(value);
+ ifNull(value);
// No additional validation required.
}
@@ -122,7 +123,7 @@
@Override
public InetAddress decodeValue(String value)
throws IllegalPropertyValueStringException {
- ensureNotNull(value);
+ ifNull(value);
try {
return InetAddress.getByName(value);
diff --git a/opendj3-server-dev/src/server/org/opends/server/admin/InstantiableRelationDefinition.java b/opendj3-server-dev/src/server/org/opends/server/admin/InstantiableRelationDefinition.java
index b962e48..ba91980 100644
--- a/opendj3-server-dev/src/server/org/opends/server/admin/InstantiableRelationDefinition.java
+++ b/opendj3-server-dev/src/server/org/opends/server/admin/InstantiableRelationDefinition.java
@@ -22,6 +22,7 @@
*
*
* Copyright 2008-2009 Sun Microsystems, Inc.
+ * Portions Copyright 2014 ForgeRock AS
*/
package org.opends.server.admin;
@@ -29,7 +30,7 @@
-import static org.opends.server.util.Validator.*;
+import static org.forgerock.util.Reject.*;
import java.util.Collections;
import java.util.HashMap;
@@ -130,7 +131,7 @@
*/
public void setNamingProperty(
PropertyDefinition<?> namingPropertyDefinition) {
- ensureNotNull(namingPropertyDefinition);
+ ifNull(namingPropertyDefinition);
this.namingPropertyDefinition = namingPropertyDefinition;
}
diff --git a/opendj3-server-dev/src/server/org/opends/server/admin/IntegerPropertyDefinition.java b/opendj3-server-dev/src/server/org/opends/server/admin/IntegerPropertyDefinition.java
index 56204c4..f590408e 100644
--- a/opendj3-server-dev/src/server/org/opends/server/admin/IntegerPropertyDefinition.java
+++ b/opendj3-server-dev/src/server/org/opends/server/admin/IntegerPropertyDefinition.java
@@ -22,6 +22,7 @@
*
*
* Copyright 2008 Sun Microsystems, Inc.
+ * Portions Copyright 2014 ForgeRock AS
*/
package org.opends.server.admin;
@@ -29,7 +30,7 @@
-import static org.opends.server.util.Validator.ensureNotNull;
+import static org.forgerock.util.Reject.ifNull;
import java.util.EnumSet;
import java.util.Locale;
@@ -276,7 +277,7 @@
@Override
public void validateValue(Integer value)
throws IllegalPropertyValueException {
- ensureNotNull(value);
+ ifNull(value);
if (!allowUnlimited && value < lowerLimit) {
throw new IllegalPropertyValueException(this, value);
@@ -297,7 +298,7 @@
@Override
public String encodeValue(Integer value)
throws IllegalPropertyValueException {
- ensureNotNull(value);
+ ifNull(value);
// Make sure that we correctly encode negative values as "unlimited".
if (allowUnlimited) {
@@ -315,7 +316,7 @@
@Override
public Integer decodeValue(String value)
throws IllegalPropertyValueStringException {
- ensureNotNull(value);
+ ifNull(value);
if (allowUnlimited) {
if (value.trim().equalsIgnoreCase(UNLIMITED)) {
diff --git a/opendj3-server-dev/src/server/org/opends/server/admin/PropertyDefinition.java b/opendj3-server-dev/src/server/org/opends/server/admin/PropertyDefinition.java
index f108e8d..a8fd20b 100644
--- a/opendj3-server-dev/src/server/org/opends/server/admin/PropertyDefinition.java
+++ b/opendj3-server-dev/src/server/org/opends/server/admin/PropertyDefinition.java
@@ -22,13 +22,14 @@
*
*
* Copyright 2008 Sun Microsystems, Inc.
+ * Portions Copyright 2014 ForgeRock AS
*/
package org.opends.server.admin;
-import static org.opends.server.util.Validator.*;
+import static org.forgerock.util.Reject.*;
import java.util.Comparator;
import java.util.EnumSet;
@@ -126,7 +127,7 @@
* The administrator action.
*/
public final void setAdministratorAction(AdministratorAction adminAction) {
- ensureNotNull(adminAction);
+ ifNull(adminAction);
this.adminAction = adminAction;
}
@@ -140,7 +141,7 @@
*/
public final void setDefaultBehaviorProvider(
DefaultBehaviorProvider<T> defaultBehavior) {
- ensureNotNull(defaultBehavior);
+ ifNull(defaultBehavior);
this.defaultBehavior = defaultBehavior;
}
@@ -153,7 +154,7 @@
* The property option.
*/
public final void setOption(PropertyOption option) {
- ensureNotNull(option);
+ ifNull(option);
options.add(option);
}
@@ -223,8 +224,8 @@
Class<T> theClass, String propertyName, EnumSet<PropertyOption> options,
AdministratorAction adminAction,
DefaultBehaviorProvider<T> defaultBehavior) {
- ensureNotNull(d, theClass, propertyName);
- ensureNotNull(options, adminAction, defaultBehavior);
+ ifNull(d, theClass, propertyName);
+ ifNull(options, adminAction, defaultBehavior);
this.definition = d;
this.theClass = theClass;
@@ -323,7 +324,7 @@
* the second.
*/
public int compare(T o1, T o2) {
- ensureNotNull(o1, o2);
+ ifNull(o1, o2);
String s1 = normalizeValue(o1);
String s2 = normalizeValue(o2);
@@ -386,7 +387,7 @@
* If the property value is invalid.
*/
public String encodeValue(T value) throws IllegalPropertyValueException {
- ensureNotNull(value);
+ ifNull(value);
return value.toString();
}
@@ -605,7 +606,7 @@
* If the property value is invalid.
*/
public String normalizeValue(T value) throws IllegalPropertyValueException {
- ensureNotNull(value);
+ ifNull(value);
return encodeValue(value);
}
diff --git a/opendj3-server-dev/src/server/org/opends/server/admin/RelationDefinition.java b/opendj3-server-dev/src/server/org/opends/server/admin/RelationDefinition.java
index 6a78540..4af0601 100644
--- a/opendj3-server-dev/src/server/org/opends/server/admin/RelationDefinition.java
+++ b/opendj3-server-dev/src/server/org/opends/server/admin/RelationDefinition.java
@@ -22,6 +22,7 @@
*
*
* Copyright 2008-2009 Sun Microsystems, Inc.
+ * Portions Copyright 2014 ForgeRock AS
*/
package org.opends.server.admin;
@@ -29,7 +30,7 @@
-import static org.opends.server.util.Validator.*;
+import static org.forgerock.util.Reject.*;
import java.util.EnumSet;
import java.util.Locale;
@@ -145,7 +146,7 @@
* The relation option.
*/
public final void setOption(RelationOption option) {
- ensureNotNull(option);
+ ifNull(option);
common.options.add(option);
}
diff --git a/opendj3-server-dev/src/server/org/opends/server/admin/SizePropertyDefinition.java b/opendj3-server-dev/src/server/org/opends/server/admin/SizePropertyDefinition.java
index 183c3e1..f576c59 100644
--- a/opendj3-server-dev/src/server/org/opends/server/admin/SizePropertyDefinition.java
+++ b/opendj3-server-dev/src/server/org/opends/server/admin/SizePropertyDefinition.java
@@ -22,13 +22,14 @@
*
*
* Copyright 2008 Sun Microsystems, Inc.
+ * Portions Copyright 2014 ForgeRock AS
*/
package org.opends.server.admin;
-import static org.opends.server.util.Validator.ensureNotNull;
+import static org.forgerock.util.Reject.ifNull;
import java.util.EnumSet;
@@ -278,7 +279,7 @@
*/
@Override
public void validateValue(Long value) throws IllegalPropertyValueException {
- ensureNotNull(value);
+ ifNull(value);
if (!allowUnlimited && value < lowerLimit) {
throw new IllegalPropertyValueException(this, value);
@@ -300,7 +301,7 @@
*/
@Override
public String encodeValue(Long value) throws IllegalPropertyValueException {
- ensureNotNull(value);
+ ifNull(value);
// Make sure that we correctly encode negative values as "unlimited".
if (allowUnlimited) {
@@ -329,7 +330,7 @@
@Override
public Long decodeValue(String value)
throws IllegalPropertyValueStringException {
- ensureNotNull(value);
+ ifNull(value);
// First check for the special "unlimited" value when necessary.
if (allowUnlimited) {
diff --git a/opendj3-server-dev/src/server/org/opends/server/admin/StringPropertyDefinition.java b/opendj3-server-dev/src/server/org/opends/server/admin/StringPropertyDefinition.java
index 20b5b96..e76b29d 100644
--- a/opendj3-server-dev/src/server/org/opends/server/admin/StringPropertyDefinition.java
+++ b/opendj3-server-dev/src/server/org/opends/server/admin/StringPropertyDefinition.java
@@ -22,6 +22,7 @@
*
*
* Copyright 2008 Sun Microsystems, Inc.
+ * Portions Copyright 2014 ForgeRock AS
*/
package org.opends.server.admin;
@@ -29,7 +30,7 @@
-import static org.opends.server.util.Validator.ensureNotNull;
+import static org.forgerock.util.Reject.ifNull;
import java.util.EnumSet;
import java.util.Locale;
@@ -203,7 +204,7 @@
@Override
public String decodeValue(String value)
throws IllegalPropertyValueStringException {
- ensureNotNull(value);
+ ifNull(value);
try {
validateValue(value);
@@ -306,7 +307,7 @@
@Override
public String normalizeValue(String value)
throws IllegalPropertyValueException {
- ensureNotNull(value);
+ ifNull(value);
if (isCaseInsensitive()) {
return value.trim().toLowerCase();
@@ -322,7 +323,7 @@
*/
@Override
public void validateValue(String value) throws IllegalPropertyValueException {
- ensureNotNull(value);
+ ifNull(value);
if (pattern != null) {
Matcher matcher = pattern.matcher(value);
diff --git a/opendj3-server-dev/src/server/org/opends/server/admin/Tag.java b/opendj3-server-dev/src/server/org/opends/server/admin/Tag.java
index f23fa85..16be23f 100644
--- a/opendj3-server-dev/src/server/org/opends/server/admin/Tag.java
+++ b/opendj3-server-dev/src/server/org/opends/server/admin/Tag.java
@@ -22,6 +22,7 @@
*
*
* Copyright 2008 Sun Microsystems, Inc.
+ * Portions Copyright 2014 ForgeRock AS
*/
package org.opends.server.admin;
import org.opends.messages.Message;
@@ -36,7 +37,7 @@
import java.util.MissingResourceException;
import org.opends.server.admin.std.meta.RootCfgDefn;
-import org.opends.server.util.Validator;
+import org.forgerock.util.Reject;
@@ -78,7 +79,7 @@
* If the tag name was not recognized.
*/
public static Tag valueOf(String name) throws IllegalArgumentException {
- Validator.ensureNotNull(name);
+ Reject.ifNull(name);
// Hack to force initialization of the tag definitions.
RootCfgDefn.getInstance();
diff --git a/opendj3-server-dev/src/server/org/opends/server/admin/client/ManagedObjectDecodingException.java b/opendj3-server-dev/src/server/org/opends/server/admin/client/ManagedObjectDecodingException.java
index cc9e6a0..05e7147 100644
--- a/opendj3-server-dev/src/server/org/opends/server/admin/client/ManagedObjectDecodingException.java
+++ b/opendj3-server-dev/src/server/org/opends/server/admin/client/ManagedObjectDecodingException.java
@@ -22,6 +22,7 @@
*
*
* Copyright 2008 Sun Microsystems, Inc.
+ * Portions Copyright 2014 ForgeRock AS
*/
package org.opends.server.admin.client;
@@ -40,7 +41,7 @@
import org.opends.server.admin.DecodingException;
import org.opends.server.admin.ManagedObjectDefinition;
import org.opends.server.admin.PropertyException;
-import org.opends.server.util.Validator;
+import org.forgerock.util.Reject;
@@ -60,8 +61,8 @@
// Create the message.
private static Message createMessage(ManagedObject<?> partialManagedObject,
Collection<PropertyException> causes) {
- Validator.ensureNotNull(causes);
- Validator.ensureTrue(!causes.isEmpty());
+ Reject.ifNull(causes);
+ Reject.ifFalse(!causes.isEmpty());
ManagedObjectDefinition<?, ?> d = partialManagedObject
.getManagedObjectDefinition();
diff --git a/opendj3-server-dev/src/server/org/opends/server/admin/client/MissingMandatoryPropertiesException.java b/opendj3-server-dev/src/server/org/opends/server/admin/client/MissingMandatoryPropertiesException.java
index a2d2f5f..8a34ccb 100644
--- a/opendj3-server-dev/src/server/org/opends/server/admin/client/MissingMandatoryPropertiesException.java
+++ b/opendj3-server-dev/src/server/org/opends/server/admin/client/MissingMandatoryPropertiesException.java
@@ -22,6 +22,7 @@
*
*
* Copyright 2008 Sun Microsystems, Inc.
+ * Portions Copyright 2014 ForgeRock AS
*/
package org.opends.server.admin.client;
@@ -38,7 +39,7 @@
import org.opends.messages.MessageBuilder;
import org.opends.server.admin.OperationsException;
import org.opends.server.admin.PropertyIsMandatoryException;
-import org.opends.server.util.Validator;
+import org.forgerock.util.Reject;
@@ -59,8 +60,8 @@
// Create the message.
private static Message createMessage(
Collection<PropertyIsMandatoryException> causes) {
- Validator.ensureNotNull(causes);
- Validator.ensureTrue(!causes.isEmpty());
+ Reject.ifNull(causes);
+ Reject.ifFalse(!causes.isEmpty());
if (causes.size() == 1) {
return ERR_MISSING_MANDATORY_PROPERTIES_EXCEPTION_SINGLE.get(causes
diff --git a/opendj3-server-dev/src/server/org/opends/server/admin/client/OperationRejectedException.java b/opendj3-server-dev/src/server/org/opends/server/admin/client/OperationRejectedException.java
index 32c4ad9..c6e314e 100644
--- a/opendj3-server-dev/src/server/org/opends/server/admin/client/OperationRejectedException.java
+++ b/opendj3-server-dev/src/server/org/opends/server/admin/client/OperationRejectedException.java
@@ -22,6 +22,7 @@
*
*
* Copyright 2008 Sun Microsystems, Inc.
+ * Portions Copyright 2014 ForgeRock AS
*/
package org.opends.server.admin.client;
@@ -36,7 +37,7 @@
import org.opends.messages.Message;
import org.opends.messages.MessageBuilder;
-import org.opends.server.util.Validator;
+import org.forgerock.util.Reject;
@@ -84,8 +85,8 @@
// Gets the default message.
private static Message getDefaultMessage(Collection<Message> messages) {
- Validator.ensureNotNull(messages);
- Validator.ensureTrue(!messages.isEmpty());
+ Reject.ifNull(messages);
+ Reject.ifFalse(!messages.isEmpty());
if (messages.size() == 1) {
return ERR_OPERATION_REJECTED_EXCEPTION_SINGLE.get(messages.iterator()
diff --git a/opendj3-server-dev/src/server/org/opends/server/admin/client/ldap/LDAPManagementContext.java b/opendj3-server-dev/src/server/org/opends/server/admin/client/ldap/LDAPManagementContext.java
index 8ac677f..20d4fbb 100644
--- a/opendj3-server-dev/src/server/org/opends/server/admin/client/ldap/LDAPManagementContext.java
+++ b/opendj3-server-dev/src/server/org/opends/server/admin/client/ldap/LDAPManagementContext.java
@@ -22,6 +22,7 @@
*
*
* Copyright 2008 Sun Microsystems, Inc.
+ * Portions Copyright 2014 ForgeRock AS
*/
package org.opends.server.admin.client.ldap;
@@ -31,7 +32,7 @@
import org.opends.server.admin.LDAPProfile;
import org.opends.server.admin.client.ManagementContext;
import org.opends.server.admin.client.spi.Driver;
-import org.opends.server.util.Validator;
+import org.forgerock.util.Reject;
@@ -49,7 +50,7 @@
* @return Returns the new management context.
*/
public static ManagementContext createFromContext(LDAPConnection connection) {
- Validator.ensureNotNull(connection);
+ Reject.ifNull(connection);
return new LDAPManagementContext(connection, LDAPProfile.getInstance());
}
diff --git a/opendj3-server-dev/src/server/org/opends/server/admin/condition/ANDCondition.java b/opendj3-server-dev/src/server/org/opends/server/admin/condition/ANDCondition.java
index 0b3c5f7..eaf3463 100644
--- a/opendj3-server-dev/src/server/org/opends/server/admin/condition/ANDCondition.java
+++ b/opendj3-server-dev/src/server/org/opends/server/admin/condition/ANDCondition.java
@@ -22,6 +22,7 @@
*
*
* Copyright 2008 Sun Microsystems, Inc.
+ * Portions Copyright 2014 ForgeRock AS
*/
package org.opends.server.admin.condition;
@@ -37,7 +38,7 @@
import org.opends.server.admin.client.ManagementContext;
import org.opends.server.admin.server.ServerManagedObject;
import org.opends.server.config.ConfigException;
-import org.opends.server.util.Validator;
+import org.forgerock.util.Reject;
@@ -61,7 +62,7 @@
* logical AND.
*/
public ANDCondition(Condition... conditions) {
- Validator.ensureNotNull(conditions);
+ Reject.ifNull(conditions);
this.conditions = Arrays.asList(conditions);
}
diff --git a/opendj3-server-dev/src/server/org/opends/server/admin/condition/ContainsCondition.java b/opendj3-server-dev/src/server/org/opends/server/admin/condition/ContainsCondition.java
index 81c4ffa..97bab5e 100644
--- a/opendj3-server-dev/src/server/org/opends/server/admin/condition/ContainsCondition.java
+++ b/opendj3-server-dev/src/server/org/opends/server/admin/condition/ContainsCondition.java
@@ -22,6 +22,7 @@
*
*
* Copyright 2008 Sun Microsystems, Inc.
+ * Portions Copyright 2014 ForgeRock AS
*/
package org.opends.server.admin.condition;
@@ -38,7 +39,7 @@
import org.opends.server.admin.client.ManagementContext;
import org.opends.server.admin.server.ServerManagedObject;
import org.opends.server.config.ConfigException;
-import org.opends.server.util.Validator;
+import org.forgerock.util.Reject;
@@ -134,7 +135,7 @@
* value.
*/
public ContainsCondition(String propertyName, String stringValue) {
- Validator.ensureNotNull(propertyName, stringValue);
+ Reject.ifNull(propertyName, stringValue);
this.propertyName = propertyName;
this.propertyStringValue = stringValue;
}
diff --git a/opendj3-server-dev/src/server/org/opends/server/admin/condition/IsPresentCondition.java b/opendj3-server-dev/src/server/org/opends/server/admin/condition/IsPresentCondition.java
index d1ff219..2fb295c 100644
--- a/opendj3-server-dev/src/server/org/opends/server/admin/condition/IsPresentCondition.java
+++ b/opendj3-server-dev/src/server/org/opends/server/admin/condition/IsPresentCondition.java
@@ -22,6 +22,7 @@
*
*
* Copyright 2008 Sun Microsystems, Inc.
+ * Portions Copyright 2014 ForgeRock AS
*/
package org.opends.server.admin.condition;
@@ -37,7 +38,7 @@
import org.opends.server.admin.client.ManagementContext;
import org.opends.server.admin.server.ServerManagedObject;
import org.opends.server.config.ConfigException;
-import org.opends.server.util.Validator;
+import org.forgerock.util.Reject;
@@ -62,7 +63,7 @@
* The property name.
*/
public IsPresentCondition(String propertyName) {
- Validator.ensureNotNull(propertyName);
+ Reject.ifNull(propertyName);
this.propertyName = propertyName;
}
diff --git a/opendj3-server-dev/src/server/org/opends/server/admin/condition/NOTCondition.java b/opendj3-server-dev/src/server/org/opends/server/admin/condition/NOTCondition.java
index bcb773e..fe83fcc 100644
--- a/opendj3-server-dev/src/server/org/opends/server/admin/condition/NOTCondition.java
+++ b/opendj3-server-dev/src/server/org/opends/server/admin/condition/NOTCondition.java
@@ -22,6 +22,7 @@
*
*
* Copyright 2008 Sun Microsystems, Inc.
+ * Portions Copyright 2014 ForgeRock AS
*/
package org.opends.server.admin.condition;
@@ -34,7 +35,7 @@
import org.opends.server.admin.client.ManagementContext;
import org.opends.server.admin.server.ServerManagedObject;
import org.opends.server.config.ConfigException;
-import org.opends.server.util.Validator;
+import org.forgerock.util.Reject;
@@ -58,7 +59,7 @@
* The sub-condition which will be inverted.
*/
public NOTCondition(Condition condition) {
- Validator.ensureNotNull(condition);
+ Reject.ifNull(condition);
this.condition = condition;
}
diff --git a/opendj3-server-dev/src/server/org/opends/server/admin/condition/ORCondition.java b/opendj3-server-dev/src/server/org/opends/server/admin/condition/ORCondition.java
index 1b95820..c66323a 100644
--- a/opendj3-server-dev/src/server/org/opends/server/admin/condition/ORCondition.java
+++ b/opendj3-server-dev/src/server/org/opends/server/admin/condition/ORCondition.java
@@ -22,6 +22,7 @@
*
*
* Copyright 2008 Sun Microsystems, Inc.
+ * Portions Copyright 2014 ForgeRock AS
*/
package org.opends.server.admin.condition;
@@ -37,7 +38,7 @@
import org.opends.server.admin.client.ManagementContext;
import org.opends.server.admin.server.ServerManagedObject;
import org.opends.server.config.ConfigException;
-import org.opends.server.util.Validator;
+import org.forgerock.util.Reject;
@@ -61,7 +62,7 @@
* logical OR.
*/
public ORCondition(Condition... conditions) {
- Validator.ensureNotNull(conditions);
+ Reject.ifNull(conditions);
this.conditions = Arrays.asList(conditions);
}
diff --git a/opendj3-server-dev/src/server/org/opends/server/admin/server/ConstraintViolationException.java b/opendj3-server-dev/src/server/org/opends/server/admin/server/ConstraintViolationException.java
index 775d603..960d893 100644
--- a/opendj3-server-dev/src/server/org/opends/server/admin/server/ConstraintViolationException.java
+++ b/opendj3-server-dev/src/server/org/opends/server/admin/server/ConstraintViolationException.java
@@ -22,6 +22,7 @@
*
*
* Copyright 2008 Sun Microsystems, Inc.
+ * Portions Copyright 2014 ForgeRock AS
*/
package org.opends.server.admin.server;
@@ -37,7 +38,7 @@
import org.opends.messages.Message;
import org.opends.messages.MessageBuilder;
import org.opends.server.admin.DecodingException;
-import org.opends.server.util.Validator;
+import org.forgerock.util.Reject;
@@ -60,8 +61,8 @@
// Gets the default message.
private static Message getDefaultMessage(Collection<Message> messages) {
- Validator.ensureNotNull(messages);
- Validator.ensureTrue(!messages.isEmpty());
+ Reject.ifNull(messages);
+ Reject.ifFalse(!messages.isEmpty());
if (messages.size() == 1) {
return ERR_CONSTRAINT_VIOLATION_EXCEPTION_SINGLE.get(messages.iterator()
diff --git a/opendj3-server-dev/src/server/org/opends/server/admin/server/ServerManagedObjectDecodingException.java b/opendj3-server-dev/src/server/org/opends/server/admin/server/ServerManagedObjectDecodingException.java
index 29236de..7e5126c 100644
--- a/opendj3-server-dev/src/server/org/opends/server/admin/server/ServerManagedObjectDecodingException.java
+++ b/opendj3-server-dev/src/server/org/opends/server/admin/server/ServerManagedObjectDecodingException.java
@@ -22,6 +22,7 @@
*
*
* Copyright 2008 Sun Microsystems, Inc.
+ * Portions Copyright 2014 ForgeRock AS
*/
package org.opends.server.admin.server;
@@ -39,7 +40,7 @@
import org.opends.server.admin.DecodingException;
import org.opends.server.admin.ManagedObjectDefinition;
import org.opends.server.admin.PropertyException;
-import org.opends.server.util.Validator;
+import org.forgerock.util.Reject;
@@ -60,8 +61,8 @@
private static Message createMessage(
ServerManagedObject<?> partialManagedObject,
Collection<PropertyException> causes) {
- Validator.ensureNotNull(causes);
- Validator.ensureTrue(!causes.isEmpty());
+ Reject.ifNull(causes);
+ Reject.ifFalse(!causes.isEmpty());
ManagedObjectDefinition<?, ?> d = partialManagedObject
.getManagedObjectDefinition();
diff --git a/opendj3-server-dev/src/server/org/opends/server/authorization/dseecompat/PatternDN.java b/opendj3-server-dev/src/server/org/opends/server/authorization/dseecompat/PatternDN.java
index 4ccc1eb..52c4eb4 100644
--- a/opendj3-server-dev/src/server/org/opends/server/authorization/dseecompat/PatternDN.java
+++ b/opendj3-server-dev/src/server/org/opends/server/authorization/dseecompat/PatternDN.java
@@ -34,7 +34,7 @@
import static org.opends.server.util.StaticUtils.isDigit;
import static org.opends.server.util.StaticUtils.isHexDigit;
import static org.opends.server.util.StaticUtils.hexStringToByteArray;
-import org.opends.server.util.Validator;
+import org.forgerock.util.Reject;
import static org.opends.server.loggers.debug.DebugLogger.*;
import org.opends.server.loggers.debug.DebugTracer;
@@ -121,7 +121,7 @@
List<PatternRDN[]> subAnyElements,
PatternRDN[] subFinal)
{
- Validator.ensureNotNull(subAnyElements);
+ Reject.ifNull(subAnyElements);
this.subInitial = subInitial;
this.subAnyElements = subAnyElements;
this.subFinal = subFinal;
diff --git a/opendj3-server-dev/src/server/org/opends/server/backends/BackupBackend.java b/opendj3-server-dev/src/server/org/opends/server/backends/BackupBackend.java
index 39ce742..3bccd20 100644
--- a/opendj3-server-dev/src/server/org/opends/server/backends/BackupBackend.java
+++ b/opendj3-server-dev/src/server/org/opends/server/backends/BackupBackend.java
@@ -47,7 +47,7 @@
import org.opends.server.types.*;
import org.opends.server.schema.BooleanSyntax;
import org.opends.server.schema.GeneralizedTimeSyntax;
-import org.opends.server.util.Validator;
+import org.forgerock.util.Reject;
import static org.opends.messages.BackendMessages.*;
import static org.opends.server.config.ConfigConstants.*;
@@ -127,7 +127,7 @@
}
- Validator.ensureTrue(config instanceof BackupBackendCfg);
+ Reject.ifFalse(config instanceof BackupBackendCfg);
currentConfig = (BackupBackendCfg)config;
}
diff --git a/opendj3-server-dev/src/server/org/opends/server/backends/LDIFBackend.java b/opendj3-server-dev/src/server/org/opends/server/backends/LDIFBackend.java
index 437c1af..067bedd 100644
--- a/opendj3-server-dev/src/server/org/opends/server/backends/LDIFBackend.java
+++ b/opendj3-server-dev/src/server/org/opends/server/backends/LDIFBackend.java
@@ -42,6 +42,7 @@
import org.opends.server.loggers.debug.DebugTracer;
import org.opends.server.types.*;
import org.opends.server.util.*;
+import org.forgerock.util.Reject;
import static org.opends.messages.BackendMessages.*;
import static org.opends.server.loggers.ErrorLogger.*;
@@ -1340,7 +1341,7 @@
{
if (config != null)
{
- Validator.ensureTrue(config instanceof LDIFBackendCfg);
+ Reject.ifFalse(config instanceof LDIFBackendCfg);
currentConfig = (LDIFBackendCfg) config;
currentConfig.addLDIFChangeListener(this);
diff --git a/opendj3-server-dev/src/server/org/opends/server/backends/MemoryBackend.java b/opendj3-server-dev/src/server/org/opends/server/backends/MemoryBackend.java
index 7919de5..7c35f4c 100644
--- a/opendj3-server-dev/src/server/org/opends/server/backends/MemoryBackend.java
+++ b/opendj3-server-dev/src/server/org/opends/server/backends/MemoryBackend.java
@@ -68,7 +68,7 @@
import org.opends.server.util.LDIFException;
import org.opends.server.util.LDIFReader;
import org.opends.server.util.LDIFWriter;
-import org.opends.server.util.Validator;
+import org.forgerock.util.Reject;
import static org.opends.messages.BackendMessages.*;
import static org.opends.server.loggers.debug.DebugLogger.*;
@@ -168,7 +168,7 @@
{
if (config != null)
{
- Validator.ensureTrue(config instanceof MemoryBackendCfg);
+ Reject.ifFalse(config instanceof MemoryBackendCfg);
MemoryBackendCfg cfg = (MemoryBackendCfg)config;
DN[] baseDNs = new DN[cfg.getBaseDN().size()];
cfg.getBaseDN().toArray(baseDNs);
diff --git a/opendj3-server-dev/src/server/org/opends/server/backends/MonitorBackend.java b/opendj3-server-dev/src/server/org/opends/server/backends/MonitorBackend.java
index 17f883a..c8e3e95 100644
--- a/opendj3-server-dev/src/server/org/opends/server/backends/MonitorBackend.java
+++ b/opendj3-server-dev/src/server/org/opends/server/backends/MonitorBackend.java
@@ -53,7 +53,7 @@
import org.opends.server.util.DynamicConstants;
import org.opends.server.util.LDIFWriter;
import org.opends.server.util.TimeThread;
-import org.opends.server.util.Validator;
+import org.forgerock.util.Reject;
@@ -193,8 +193,8 @@
public void configureBackend(final Configuration config)
throws ConfigException
{
- Validator.ensureNotNull(config);
- Validator.ensureTrue(config instanceof MonitorBackendCfg);
+ Reject.ifNull(config);
+ Reject.ifFalse(config instanceof MonitorBackendCfg);
final MonitorBackendCfg cfg = (MonitorBackendCfg) config;
final ConfigEntry configEntry = DirectoryServer.getConfigEntry(cfg.dn());
diff --git a/opendj3-server-dev/src/server/org/opends/server/backends/NullBackend.java b/opendj3-server-dev/src/server/org/opends/server/backends/NullBackend.java
index 7233a58..8a95b8b 100644
--- a/opendj3-server-dev/src/server/org/opends/server/backends/NullBackend.java
+++ b/opendj3-server-dev/src/server/org/opends/server/backends/NullBackend.java
@@ -22,6 +22,7 @@
*
*
* Copyright 2008 Sun Microsystems, Inc.
+ * Portions Copyright 2014 ForgeRock AS
*/
package org.opends.server.backends;
@@ -65,7 +66,7 @@
import org.opends.server.util.LDIFException;
import org.opends.server.util.LDIFReader;
import org.opends.server.util.LDIFWriter;
-import org.opends.server.util.Validator;
+import org.forgerock.util.Reject;
import static org.opends.messages.BackendMessages.*;
import static org.opends.server.loggers.debug.DebugLogger.*;
@@ -160,7 +161,7 @@
{
if (config != null)
{
- Validator.ensureTrue(config instanceof BackendCfg);
+ Reject.ifFalse(config instanceof BackendCfg);
BackendCfg cfg = (BackendCfg)config;
DN[] cfgBaseDNs = new DN[cfg.getBaseDN().size()];
cfg.getBaseDN().toArray(cfgBaseDNs);
diff --git a/opendj3-server-dev/src/server/org/opends/server/backends/RootDSEBackend.java b/opendj3-server-dev/src/server/org/opends/server/backends/RootDSEBackend.java
index 0d4061c..48d820e 100644
--- a/opendj3-server-dev/src/server/org/opends/server/backends/RootDSEBackend.java
+++ b/opendj3-server-dev/src/server/org/opends/server/backends/RootDSEBackend.java
@@ -62,7 +62,7 @@
import org.opends.server.loggers.debug.DebugTracer;
import org.opends.server.types.*;
import org.opends.server.util.LDIFWriter;
-import org.opends.server.util.Validator;
+import org.forgerock.util.Reject;
import static org.opends.messages.BackendMessages.*;
import static org.opends.messages.ConfigMessages.
@@ -158,8 +158,8 @@
public void configureBackend(Configuration config)
throws ConfigException
{
- Validator.ensureNotNull(config);
- Validator.ensureTrue(config instanceof RootDSEBackendCfg);
+ Reject.ifNull(config);
+ Reject.ifFalse(config instanceof RootDSEBackendCfg);
currentConfig = (RootDSEBackendCfg)config;
configEntryDN = config.dn();
}
diff --git a/opendj3-server-dev/src/server/org/opends/server/backends/SchemaBackend.java b/opendj3-server-dev/src/server/org/opends/server/backends/SchemaBackend.java
index 7666dc4..32a6f88 100644
--- a/opendj3-server-dev/src/server/org/opends/server/backends/SchemaBackend.java
+++ b/opendj3-server-dev/src/server/org/opends/server/backends/SchemaBackend.java
@@ -86,7 +86,7 @@
import org.opends.server.util.LDIFException;
import org.opends.server.util.LDIFReader;
import org.opends.server.util.LDIFWriter;
-import org.opends.server.util.Validator;
+import org.forgerock.util.Reject;
import static org.opends.messages.BackendMessages.*;
import static org.opends.messages.ConfigMessages.*;
@@ -274,7 +274,7 @@
throw new ConfigException(message);
}
- Validator.ensureTrue(config instanceof SchemaBackendCfg);
+ Reject.ifFalse(config instanceof SchemaBackendCfg);
SchemaBackendCfg cfg = (SchemaBackendCfg)config;
ConfigEntry configEntry = DirectoryServer.getConfigEntry(cfg.dn());
diff --git a/opendj3-server-dev/src/server/org/opends/server/backends/TrustStoreBackend.java b/opendj3-server-dev/src/server/org/opends/server/backends/TrustStoreBackend.java
index ede21c5..0ce39f9 100644
--- a/opendj3-server-dev/src/server/org/opends/server/backends/TrustStoreBackend.java
+++ b/opendj3-server-dev/src/server/org/opends/server/backends/TrustStoreBackend.java
@@ -78,7 +78,7 @@
import org.opends.server.types.*;
import org.opends.server.util.CertificateManager;
import org.opends.server.util.SetupUtils;
-import org.opends.server.util.Validator;
+import org.forgerock.util.Reject;
@@ -149,8 +149,8 @@
@Override()
public void configureBackend(Configuration config) throws ConfigException
{
- Validator.ensureNotNull(config);
- Validator.ensureTrue(config instanceof TrustStoreBackendCfg);
+ Reject.ifNull(config);
+ Reject.ifFalse(config instanceof TrustStoreBackendCfg);
configuration = (TrustStoreBackendCfg)config;
}
diff --git a/opendj3-server-dev/src/server/org/opends/server/backends/jeb/BackendImpl.java b/opendj3-server-dev/src/server/org/opends/server/backends/jeb/BackendImpl.java
index 12e86a3..3f12406 100644
--- a/opendj3-server-dev/src/server/org/opends/server/backends/jeb/BackendImpl.java
+++ b/opendj3-server-dev/src/server/org/opends/server/backends/jeb/BackendImpl.java
@@ -54,7 +54,7 @@
import org.opends.server.loggers.debug.DebugTracer;
import org.opends.server.types.*;
import org.opends.server.util.RuntimeInformation;
-import org.opends.server.util.Validator;
+import org.forgerock.util.Reject;
import com.sleepycat.je.DatabaseException;
import com.sleepycat.je.Durability;
@@ -268,8 +268,8 @@
public void configureBackend(Configuration cfg)
throws ConfigException
{
- Validator.ensureNotNull(cfg);
- Validator.ensureTrue(cfg instanceof LocalDBBackendCfg);
+ Reject.ifNull(cfg);
+ Reject.ifFalse(cfg instanceof LocalDBBackendCfg);
this.cfg = (LocalDBBackendCfg)cfg;
diff --git a/opendj3-server-dev/src/server/org/opends/server/backends/jeb/DataConfig.java b/opendj3-server-dev/src/server/org/opends/server/backends/jeb/DataConfig.java
index b38d462..0bc479c 100644
--- a/opendj3-server-dev/src/server/org/opends/server/backends/jeb/DataConfig.java
+++ b/opendj3-server-dev/src/server/org/opends/server/backends/jeb/DataConfig.java
@@ -22,12 +22,13 @@
*
*
* Copyright 2006-2008 Sun Microsystems, Inc.
+ * Portions Copyright 2014 ForgeRock AS
*/
package org.opends.server.backends.jeb;
import org.opends.server.types.EntryEncodeConfig;
-import static org.opends.server.util.Validator.*;
+import static org.forgerock.util.Reject.*;
/**
* Configuration class to indicate desired compression and cryptographic options
@@ -61,7 +62,7 @@
if (compressedSchema == null)
{
- ensureTrue(! compactEncoding);
+ ifFalse(! compactEncoding);
this.encodeConfig = new EntryEncodeConfig(false, compactEncoding, false);
}
else
@@ -115,7 +116,7 @@
{
if (compressedSchema == null)
{
- ensureTrue(! compactEncoding);
+ ifFalse(! compactEncoding);
this.encodeConfig = new EntryEncodeConfig(false, compactEncoding,
compactEncoding);
}
diff --git a/opendj3-server-dev/src/server/org/opends/server/backends/task/TaskBackend.java b/opendj3-server-dev/src/server/org/opends/server/backends/task/TaskBackend.java
index 59e2095..127175b 100644
--- a/opendj3-server-dev/src/server/org/opends/server/backends/task/TaskBackend.java
+++ b/opendj3-server-dev/src/server/org/opends/server/backends/task/TaskBackend.java
@@ -51,6 +51,7 @@
import org.opends.server.loggers.debug.DebugTracer;
import org.opends.server.types.*;
import org.opends.server.util.*;
+import org.forgerock.util.Reject;
import static org.opends.messages.BackendMessages.*;
import static org.opends.server.config.ConfigConstants.*;
@@ -140,8 +141,8 @@
public void configureBackend(Configuration config)
throws ConfigException
{
- Validator.ensureNotNull(config);
- Validator.ensureTrue(config instanceof TaskBackendCfg);
+ Reject.ifNull(config);
+ Reject.ifFalse(config instanceof TaskBackendCfg);
TaskBackendCfg cfg = (TaskBackendCfg)config;
diff --git a/opendj3-server-dev/src/server/org/opends/server/controls/MatchedValuesFilter.java b/opendj3-server-dev/src/server/org/opends/server/controls/MatchedValuesFilter.java
index 52af02a..99977e7 100644
--- a/opendj3-server-dev/src/server/org/opends/server/controls/MatchedValuesFilter.java
+++ b/opendj3-server-dev/src/server/org/opends/server/controls/MatchedValuesFilter.java
@@ -22,6 +22,7 @@
*
*
* Copyright 2006-2010 Sun Microsystems, Inc.
+ * Portions Copyright 2014 ForgeRock AS
*/
package org.opends.server.controls;
import org.opends.messages.Message;
@@ -40,7 +41,7 @@
import org.opends.server.core.DirectoryServer;
import org.opends.server.protocols.asn1.*;
import org.opends.server.protocols.ldap.LDAPResultCode;
-import org.opends.server.util.Validator;
+import org.forgerock.util.Reject;
import static org.opends.server.loggers.debug.DebugLogger.*;
import org.opends.server.loggers.debug.DebugTracer;
@@ -226,7 +227,7 @@
String rawAttributeType,
ByteString rawAssertionValue)
{
- Validator.ensureNotNull(rawAttributeType,rawAssertionValue);
+ Reject.ifNull(rawAttributeType,rawAssertionValue);
return new MatchedValuesFilter(EQUALITY_MATCH_TYPE, rawAttributeType,
rawAssertionValue, null, null, null, null);
@@ -246,7 +247,7 @@
AttributeType attributeType,
AttributeValue assertionValue)
{
- Validator.ensureNotNull(attributeType, assertionValue);
+ Reject.ifNull(attributeType, assertionValue);
String rawAttributeType = attributeType.getNameOrOID();
ByteString rawAssertionValue = assertionValue.getValue();
@@ -277,7 +278,7 @@
List<ByteString> subAny,
ByteString subFinal)
{
- Validator.ensureNotNull(rawAttributeType);
+ Reject.ifNull(rawAttributeType);
return new MatchedValuesFilter(SUBSTRINGS_TYPE, rawAttributeType, null,
subInitial, subAny, subFinal, null);
}
@@ -300,7 +301,7 @@
List<ByteString> subAny,
ByteString subFinal)
{
- Validator.ensureNotNull(attributeType);
+ Reject.ifNull(attributeType);
String rawAttributeType = attributeType.getNameOrOID();
MatchedValuesFilter filter =
@@ -325,7 +326,7 @@
String rawAttributeType,
ByteString rawAssertionValue)
{
- Validator.ensureNotNull(rawAttributeType, rawAssertionValue);
+ Reject.ifNull(rawAttributeType, rawAssertionValue);
return new MatchedValuesFilter(GREATER_OR_EQUAL_TYPE, rawAttributeType,
rawAssertionValue, null, null, null, null);
@@ -345,7 +346,7 @@
AttributeType attributeType,
AttributeValue assertionValue)
{
- Validator.ensureNotNull(attributeType, assertionValue);
+ Reject.ifNull(attributeType, assertionValue);
String rawAttributeType = attributeType.getNameOrOID();
ByteString rawAssertionValue = assertionValue.getValue();
@@ -373,7 +374,7 @@
String rawAttributeType,
ByteString rawAssertionValue)
{
- Validator.ensureNotNull(rawAttributeType, rawAssertionValue);
+ Reject.ifNull(rawAttributeType, rawAssertionValue);
return new MatchedValuesFilter(LESS_OR_EQUAL_TYPE, rawAttributeType,
rawAssertionValue, null, null, null, null);
}
@@ -392,7 +393,7 @@
AttributeType attributeType,
AttributeValue assertionValue)
{
- Validator.ensureNotNull(attributeType, assertionValue);
+ Reject.ifNull(attributeType, assertionValue);
String rawAttributeType = attributeType.getNameOrOID();
ByteString rawAssertionValue = assertionValue.getValue();
@@ -417,7 +418,7 @@
*/
public static MatchedValuesFilter createPresentFilter(String rawAttributeType)
{
- Validator.ensureNotNull(rawAttributeType) ;
+ Reject.ifNull(rawAttributeType) ;
return new MatchedValuesFilter(PRESENT_TYPE, rawAttributeType, null, null,
null, null, null);
}
@@ -434,7 +435,7 @@
public static MatchedValuesFilter createPresentFilter(
AttributeType attributeType)
{
- Validator.ensureNotNull(attributeType);
+ Reject.ifNull(attributeType);
String rawAttributeType = attributeType.getNameOrOID();
MatchedValuesFilter filter =
@@ -459,7 +460,7 @@
String rawAttributeType,
ByteString rawAssertionValue)
{
- Validator.ensureNotNull(rawAttributeType,rawAssertionValue);
+ Reject.ifNull(rawAttributeType,rawAssertionValue);
return new MatchedValuesFilter(APPROXIMATE_MATCH_TYPE, rawAttributeType,
rawAssertionValue, null, null, null, null);
@@ -479,7 +480,7 @@
AttributeType attributeType,
AttributeValue assertionValue)
{
- Validator.ensureNotNull(attributeType,assertionValue);
+ Reject.ifNull(attributeType,assertionValue);
String rawAttributeType = attributeType.getNameOrOID();
ByteString rawAssertionValue = assertionValue.getValue();
@@ -508,8 +509,7 @@
String matchingRuleID,
ByteString rawAssertionValue)
{
- Validator
- .ensureNotNull(rawAttributeType, matchingRuleID, rawAssertionValue);
+ Reject.ifNull(rawAttributeType, matchingRuleID, rawAssertionValue);
return new MatchedValuesFilter(EXTENSIBLE_MATCH_TYPE, rawAttributeType,
rawAssertionValue, null, null, null,
matchingRuleID);
@@ -531,7 +531,7 @@
MatchingRule matchingRule,
AttributeValue assertionValue)
{
- Validator.ensureNotNull(attributeType, matchingRule, assertionValue);
+ Reject.ifNull(attributeType, matchingRule, assertionValue);
String rawAttributeType = attributeType.getNameOrOID();
String matchingRuleID = matchingRule.getOID();
ByteString rawAssertionValue = assertionValue.getValue();
diff --git a/opendj3-server-dev/src/server/org/opends/server/controls/ProxiedAuthV2Control.java b/opendj3-server-dev/src/server/org/opends/server/controls/ProxiedAuthV2Control.java
index 45108fc..58f00dc 100644
--- a/opendj3-server-dev/src/server/org/opends/server/controls/ProxiedAuthV2Control.java
+++ b/opendj3-server-dev/src/server/org/opends/server/controls/ProxiedAuthV2Control.java
@@ -44,7 +44,7 @@
import static org.opends.server.loggers.debug.DebugLogger.*;
import static org.opends.server.util.ServerConstants.*;
import static org.opends.server.util.StaticUtils.*;
-import static org.opends.server.util.Validator.*;
+import static org.forgerock.util.Reject.*;
/**
* This class implements version 2 of the proxied authorization control as
@@ -166,7 +166,7 @@
{
super(OID_PROXIED_AUTH_V2, isCritical);
- ensureNotNull(authorizationID);
+ ifNull(authorizationID);
this.authorizationID = authorizationID;
}
diff --git a/opendj3-server-dev/src/server/org/opends/server/core/BaseDnRegistry.java b/opendj3-server-dev/src/server/org/opends/server/core/BaseDnRegistry.java
index 85213de..0ae5c59 100644
--- a/opendj3-server-dev/src/server/org/opends/server/core/BaseDnRegistry.java
+++ b/opendj3-server-dev/src/server/org/opends/server/core/BaseDnRegistry.java
@@ -31,7 +31,7 @@
import org.opends.server.types.DirectoryException;
import org.opends.server.types.ResultCode;
import org.opends.server.api.Backend;
-import static org.opends.server.util.Validator.ensureNotNull;
+import static org.forgerock.util.Reject.ifNull;
import org.opends.messages.Message;
import static org.opends.messages.CoreMessages.*;
@@ -275,7 +275,7 @@
{
LinkedList<Message> errors = new LinkedList<Message>();
- ensureNotNull(baseDN);
+ ifNull(baseDN);
// Make sure that the Directory Server actually contains a backend with
// the specified base DN.
diff --git a/opendj3-server-dev/src/server/org/opends/server/core/DirectoryServer.java b/opendj3-server-dev/src/server/org/opends/server/core/DirectoryServer.java
index 4a51be1..e9cb3a3 100644
--- a/opendj3-server-dev/src/server/org/opends/server/core/DirectoryServer.java
+++ b/opendj3-server-dev/src/server/org/opends/server/core/DirectoryServer.java
@@ -37,7 +37,7 @@
import static org.opends.server.util.DynamicConstants.*;
import static org.opends.server.util.ServerConstants.*;
import static org.opends.server.util.StaticUtils.*;
-import static org.opends.server.util.Validator.*;
+import static org.forgerock.util.Reject.*;
import java.io.*;
import java.lang.management.ManagementFactory;
@@ -89,6 +89,7 @@
import org.opends.server.tools.ConfigureWindowsService;
import org.opends.server.types.*;
import org.opends.server.util.*;
+import org.forgerock.util.Reject;
import org.opends.server.util.args.*;
import org.opends.server.workflowelement.WorkflowElement;
import org.opends.server.workflowelement.WorkflowElementConfigManager;
@@ -2998,7 +2999,7 @@
public static void setOfflineSchemaChanges(List<Modification>
offlineSchemaChanges)
{
- ensureNotNull(offlineSchemaChanges);
+ ifNull(offlineSchemaChanges);
directoryServer.offlineSchemaChanges = offlineSchemaChanges;
}
@@ -5023,7 +5024,7 @@
*/
public static AuthenticationPolicy getAuthenticationPolicy(DN configEntryDN)
{
- Validator.ensureNotNull(configEntryDN);
+ Reject.ifNull(configEntryDN);
return directoryServer.authenticationPolicies.get(configEntryDN);
}
@@ -5043,7 +5044,7 @@
public static void registerAuthenticationPolicy(DN configEntryDN,
AuthenticationPolicy policy)
{
- Validator.ensureNotNull(configEntryDN, policy);
+ Reject.ifNull(configEntryDN, policy);
// Ensure default policy is synchronized.
synchronized (directoryServer.authenticationPolicies)
@@ -5076,7 +5077,7 @@
*/
public static void deregisterAuthenticationPolicy(DN configEntryDN)
{
- Validator.ensureNotNull(configEntryDN);
+ Reject.ifNull(configEntryDN);
// Ensure default policy is synchronized.
synchronized (directoryServer.authenticationPolicies)
@@ -5184,7 +5185,7 @@
*/
public static RotationPolicy getRotationPolicy(DN configEntryDN)
{
- Validator.ensureNotNull(configEntryDN);
+ Reject.ifNull(configEntryDN);
return directoryServer.rotationPolicies.get(configEntryDN);
}
@@ -5201,7 +5202,7 @@
public static void registerRotationPolicy(DN configEntryDN,
RotationPolicy policy)
{
- Validator.ensureNotNull(configEntryDN, policy);
+ Reject.ifNull(configEntryDN, policy);
directoryServer.rotationPolicies.put(configEntryDN, policy);
}
@@ -5217,7 +5218,7 @@
*/
public static void deregisterRotationPolicy(DN configEntryDN)
{
- Validator.ensureNotNull(configEntryDN);
+ Reject.ifNull(configEntryDN);
directoryServer.rotationPolicies.remove(configEntryDN);
}
@@ -5234,7 +5235,7 @@
*/
public static RetentionPolicy getRetentionPolicy(DN configEntryDN)
{
- Validator.ensureNotNull(configEntryDN);
+ Reject.ifNull(configEntryDN);
return directoryServer.retentionPolicies.get(configEntryDN);
}
@@ -5251,7 +5252,7 @@
public static void registerRetentionPolicy(DN configEntryDN,
RetentionPolicy policy)
{
- Validator.ensureNotNull(configEntryDN, policy);
+ Reject.ifNull(configEntryDN, policy);
directoryServer.retentionPolicies.put(configEntryDN, policy);
}
@@ -5267,7 +5268,7 @@
*/
public static void deregisterRetentionPolicy(DN configEntryDN)
{
- Validator.ensureNotNull(configEntryDN);
+ Reject.ifNull(configEntryDN);
directoryServer.retentionPolicies.remove(configEntryDN);
}
@@ -6015,10 +6016,10 @@
public static void registerBackend(Backend backend)
throws DirectoryException
{
- ensureNotNull(backend);
+ ifNull(backend);
String backendID = backend.getBackendID();
- ensureNotNull(backendID);
+ ifNull(backendID);
synchronized (directoryServer)
{
@@ -6064,7 +6065,7 @@
*/
public static void deregisterBackend(Backend backend)
{
- ensureNotNull(backend);
+ ifNull(backend);
synchronized (directoryServer)
{
@@ -6226,7 +6227,7 @@
boolean isPrivate)
throws DirectoryException
{
- ensureNotNull(baseDN, backend);
+ ifNull(baseDN, backend);
synchronized (directoryServer)
{
@@ -6275,7 +6276,7 @@
public static void deregisterBaseDN(DN baseDN)
throws DirectoryException
{
- ensureNotNull(baseDN);
+ ifNull(baseDN);
synchronized(directoryServer) {
@@ -9707,10 +9708,10 @@
*/
public static void registerWorkflowElement(WorkflowElement we)
throws DirectoryException {
- ensureNotNull(we);
+ ifNull(we);
String workflowElementID = we.getWorkflowElementID();
- ensureNotNull(workflowElementID);
+ ifNull(workflowElementID);
synchronized (directoryServer)
{
@@ -9730,10 +9731,10 @@
* {@code null}.
*/
public static void deregisterWorkflowElement(WorkflowElement we) {
- ensureNotNull(we);
+ ifNull(we);
String workflowElementID = we.getWorkflowElementID();
- ensureNotNull(workflowElementID);
+ ifNull(workflowElementID);
synchronized (directoryServer)
{
diff --git a/opendj3-server-dev/src/server/org/opends/server/core/WorkflowImpl.java b/opendj3-server-dev/src/server/org/opends/server/core/WorkflowImpl.java
index b2fd750..ffd86bd 100644
--- a/opendj3-server-dev/src/server/org/opends/server/core/WorkflowImpl.java
+++ b/opendj3-server-dev/src/server/org/opends/server/core/WorkflowImpl.java
@@ -22,11 +22,12 @@
*
*
* Copyright 2008 Sun Microsystems, Inc.
+ * Portions Copyright 2014 ForgeRock AS
*/
package org.opends.server.core;
import static org.opends.messages.CoreMessages.*;
-import static org.opends.server.util.Validator.ensureNotNull;
+import static org.forgerock.util.Reject.ifNull;
import java.util.Collection;
import java.util.Observable;
@@ -216,7 +217,7 @@
public void register()
throws DirectoryException
{
- ensureNotNull(workflowID);
+ ifNull(workflowID);
synchronized (registeredWorkflowsLock)
{
@@ -241,7 +242,7 @@
*/
public void deregister()
{
- ensureNotNull(workflowID);
+ ifNull(workflowID);
// Deregister the workflow with the list of objects to notify when
// a workflow element is created or deleted.
diff --git a/opendj3-server-dev/src/server/org/opends/server/core/networkgroups/NetworkGroup.java b/opendj3-server-dev/src/server/org/opends/server/core/networkgroups/NetworkGroup.java
index 4dc9329..0ce30b4 100644
--- a/opendj3-server-dev/src/server/org/opends/server/core/networkgroups/NetworkGroup.java
+++ b/opendj3-server-dev/src/server/org/opends/server/core/networkgroups/NetworkGroup.java
@@ -33,7 +33,7 @@
import static org.opends.server.loggers.ErrorLogger.*;
import static org.opends.server.loggers.debug.DebugLogger.*;
import static org.opends.server.util.StaticUtils.*;
-import static org.opends.server.util.Validator.*;
+import static org.forgerock.util.Reject.*;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
@@ -1414,7 +1414,7 @@
*/
void register() throws InitializationException
{
- ensureNotNull(networkGroupID);
+ ifNull(networkGroupID);
synchronized (registeredNetworkGroupsLock)
{
@@ -1564,7 +1564,7 @@
throws DirectoryException
{
String workflowID = workflowNode.getWorkflowImpl().getWorkflowId();
- ensureNotNull(workflowID);
+ ifNull(workflowID);
// If the network group is the "internal" network group then bypass
// the check because the internal network group may contain
@@ -1967,7 +1967,7 @@
throws DirectoryException
{
String workflowID = workflowNode.getWorkflowImpl().getWorkflowId();
- ensureNotNull(workflowID);
+ ifNull(workflowID);
synchronized (registeredWorkflowNodesLock)
{
diff --git a/opendj3-server-dev/src/server/org/opends/server/crypto/CryptoManagerImpl.java b/opendj3-server-dev/src/server/org/opends/server/crypto/CryptoManagerImpl.java
index 6905c37..3f10e85 100644
--- a/opendj3-server-dev/src/server/org/opends/server/crypto/CryptoManagerImpl.java
+++ b/opendj3-server-dev/src/server/org/opends/server/crypto/CryptoManagerImpl.java
@@ -66,7 +66,7 @@
import static org.opends.server.loggers.debug.DebugLogger.*;
import org.opends.server.loggers.debug.DebugTracer;
import static org.opends.server.util.StaticUtils.*;
-import org.opends.server.util.Validator;
+import org.forgerock.util.Reject;
import org.opends.server.util.SelectableCertificateKeyManager;
import org.opends.server.util.StaticUtils;
import org.opends.server.util.Base64;
@@ -1378,7 +1378,7 @@
* {@code KeyEntryID}.
*/
public KeyEntryID(final byte[] keyEntryID) {
- Validator.ensureTrue(getByteValueLength() == keyEntryID.length);
+ Reject.ifFalse(getByteValueLength() == keyEntryID.length);
long hiBytes = 0;
long loBytes = 0;
for (int i = 0; i < 8; ++i) {
@@ -1854,8 +1854,8 @@
final int ivLengthBits,
final boolean isCompromised)
throws CryptoManagerException {
- Validator.ensureNotNull(keyIDString, transformation, secretKey);
- Validator.ensureTrue(0 <= ivLengthBits);
+ Reject.ifNull(keyIDString, transformation, secretKey);
+ Reject.ifFalse(0 <= ivLengthBits);
final KeyEntryID keyID = new KeyEntryID(keyIDString);
@@ -1920,8 +1920,8 @@
final CryptoManagerImpl cryptoManager,
final String transformation,
final int keyLengthBits) {
- Validator.ensureNotNull(cryptoManager, transformation);
- Validator.ensureTrue(0 < keyLengthBits);
+ Reject.ifNull(cryptoManager, transformation);
+ Reject.ifFalse(0 < keyLengthBits);
CipherKeyEntry keyEntry = null;
// search for an existing key that satisfies the request
@@ -2082,7 +2082,7 @@
* @param ivLengthBits The initiazliation vector length in bits.
*/
private void setIVLengthBits(int ivLengthBits) {
- Validator.ensureTrue(-1 == fIVLengthBits && 0 <= ivLengthBits);
+ Reject.ifFalse(-1 == fIVLengthBits && 0 <= ivLengthBits);
fIVLengthBits = ivLengthBits;
}
@@ -2131,13 +2131,13 @@
final int mode,
final byte[] initializationVector)
throws CryptoManagerException {
- Validator.ensureTrue(Cipher.ENCRYPT_MODE == mode
+ Reject.ifFalse(Cipher.ENCRYPT_MODE == mode
|| Cipher.DECRYPT_MODE == mode);
- Validator.ensureTrue(Cipher.ENCRYPT_MODE != mode
+ Reject.ifFalse(Cipher.ENCRYPT_MODE != mode
|| null == initializationVector);
- Validator.ensureTrue(-1 != keyEntry.getIVLengthBits()
+ Reject.ifFalse(-1 != keyEntry.getIVLengthBits()
|| Cipher.ENCRYPT_MODE == mode);
- Validator.ensureTrue(null == initializationVector
+ Reject.ifFalse(null == initializationVector
|| initializationVector.length * Byte.SIZE
== keyEntry.getIVLengthBits());
@@ -2237,7 +2237,7 @@
final String algorithm,
final int keyLengthBits)
throws CryptoManagerException {
- Validator.ensureNotNull(algorithm);
+ Reject.ifNull(algorithm);
final Map<KeyEntryID, MacKeyEntry> cache = (null == cryptoManager)
? null : cryptoManager.macKeyEntryCache;
@@ -2392,7 +2392,7 @@
final int secretKeyLengthBits,
final boolean isCompromised)
throws CryptoManagerException {
- Validator.ensureNotNull(keyIDString, secretKey);
+ Reject.ifNull(keyIDString, secretKey);
final KeyEntryID keyID = new KeyEntryID(keyIDString);
@@ -2451,8 +2451,8 @@
final CryptoManagerImpl cryptoManager,
final String algorithm,
final int keyLengthBits) {
- Validator.ensureNotNull(cryptoManager, algorithm);
- Validator.ensureTrue(0 < keyLengthBits);
+ Reject.ifNull(cryptoManager, algorithm);
+ Reject.ifFalse(0 < keyLengthBits);
MacKeyEntry keyEntry = null;
// search for an existing key that satisfies the request
@@ -2717,7 +2717,7 @@
public String getMacEngineKeyEntryID(final String macAlgorithm,
final int keyLengthBits)
throws CryptoManagerException {
- Validator.ensureNotNull(macAlgorithm);
+ Reject.ifNull(macAlgorithm);
MacKeyEntry keyEntry = MacKeyEntry.getKeyEntry(this, macAlgorithm,
keyLengthBits);
@@ -2755,7 +2755,7 @@
byte[] data)
throws GeneralSecurityException, CryptoManagerException
{
- Validator.ensureNotNull(cipherTransformation, data);
+ Reject.ifNull(cipherTransformation, data);
CipherKeyEntry keyEntry = CipherKeyEntry.getKeyEntry(this,
cipherTransformation, keyLengthBits);
@@ -2801,7 +2801,7 @@
OutputStream outputStream)
throws CryptoManagerException
{
- Validator.ensureNotNull(cipherTransformation, outputStream);
+ Reject.ifNull(cipherTransformation, outputStream);
CipherKeyEntry keyEntry = CipherKeyEntry.getKeyEntry(
this, cipherTransformation, keyLengthBits);
diff --git a/opendj3-server-dev/src/server/org/opends/server/extensions/DynamicGroup.java b/opendj3-server-dev/src/server/org/opends/server/extensions/DynamicGroup.java
index 88dcbc4..5aa60b7 100644
--- a/opendj3-server-dev/src/server/org/opends/server/extensions/DynamicGroup.java
+++ b/opendj3-server-dev/src/server/org/opends/server/extensions/DynamicGroup.java
@@ -59,7 +59,7 @@
import static org.opends.server.config.ConfigConstants.*;
import static org.opends.server.loggers.debug.DebugLogger.*;
import static org.opends.server.util.ServerConstants.*;
-import static org.opends.server.util.Validator.*;
+import static org.forgerock.util.Reject.*;
@@ -112,7 +112,7 @@
{
super();
- ensureNotNull(groupEntryDN, memberURLs);
+ ifNull(groupEntryDN, memberURLs);
this.groupEntryDN = groupEntryDN;
this.memberURLs = memberURLs;
@@ -141,7 +141,7 @@
public DynamicGroup newInstance(Entry groupEntry)
throws DirectoryException
{
- ensureNotNull(groupEntry);
+ ifNull(groupEntry);
// Get the memberURL attribute from the entry, if there is one, and parse
@@ -203,7 +203,7 @@
@Override()
public boolean isGroupDefinition(Entry entry)
{
- ensureNotNull(entry);
+ ifNull(entry);
// FIXME -- This needs to exclude enhanced groups once we have support for
//them.
diff --git a/opendj3-server-dev/src/server/org/opends/server/extensions/FilteredStaticGroupMemberList.java b/opendj3-server-dev/src/server/org/opends/server/extensions/FilteredStaticGroupMemberList.java
index dd1b88a..1cfcc6a 100644
--- a/opendj3-server-dev/src/server/org/opends/server/extensions/FilteredStaticGroupMemberList.java
+++ b/opendj3-server-dev/src/server/org/opends/server/extensions/FilteredStaticGroupMemberList.java
@@ -47,7 +47,7 @@
import org.opends.server.loggers.debug.DebugTracer;
import org.opends.server.types.DebugLogLevel;
import static org.opends.messages.ExtensionMessages.*;
-import static org.opends.server.util.Validator.*;
+import static org.forgerock.util.Reject.*;
@@ -116,7 +116,7 @@
DN baseDN, SearchScope scope,
SearchFilter filter)
{
- ensureNotNull(groupDN, memberDNs);
+ ifNull(groupDN, memberDNs);
this.groupDN = groupDN;
this.memberDNs = new ArrayList<ByteString>(memberDNs);
diff --git a/opendj3-server-dev/src/server/org/opends/server/extensions/SimpleStaticGroupMemberList.java b/opendj3-server-dev/src/server/org/opends/server/extensions/SimpleStaticGroupMemberList.java
index 9340f70..20a9ddf 100644
--- a/opendj3-server-dev/src/server/org/opends/server/extensions/SimpleStaticGroupMemberList.java
+++ b/opendj3-server-dev/src/server/org/opends/server/extensions/SimpleStaticGroupMemberList.java
@@ -22,7 +22,7 @@
*
*
* Copyright 2008 Sun Microsystems, Inc.
- * Portions Copyright 2011 ForgeRock AS
+ * Portions Copyright 2011-2014 ForgeRock AS
*/
package org.opends.server.extensions;
import org.opends.messages.Message;
@@ -45,7 +45,7 @@
import org.opends.server.loggers.debug.DebugTracer;
import org.opends.server.types.DebugLogLevel;
import static org.opends.messages.ExtensionMessages.*;
-import static org.opends.server.util.Validator.*;
+import static org.forgerock.util.Reject.*;
@@ -88,7 +88,7 @@
*/
public SimpleStaticGroupMemberList(DN groupDN, Set<ByteString> memberDNs)
{
- ensureNotNull(groupDN, memberDNs);
+ ifNull(groupDN, memberDNs);
this.groupDN = groupDN;
this.memberDNs = new ArrayList<ByteString>(memberDNs);
diff --git a/opendj3-server-dev/src/server/org/opends/server/extensions/StaticGroup.java b/opendj3-server-dev/src/server/org/opends/server/extensions/StaticGroup.java
index 1bf784f..fd3a659 100644
--- a/opendj3-server-dev/src/server/org/opends/server/extensions/StaticGroup.java
+++ b/opendj3-server-dev/src/server/org/opends/server/extensions/StaticGroup.java
@@ -70,7 +70,7 @@
import static org.opends.server.loggers.debug.DebugLogger.*;
import static org.opends.server.protocols.internal.InternalClientConnection.*;
import static org.opends.server.util.ServerConstants.*;
-import static org.opends.server.util.Validator.*;
+import static org.forgerock.util.Reject.*;
@@ -140,7 +140,7 @@
super();
- ensureNotNull(groupEntryDN, memberAttributeType, memberDNs);
+ ifNull(groupEntryDN, memberAttributeType, memberDNs);
this.groupEntryDN = groupEntryDN;
this.memberAttributeType = memberAttributeType;
@@ -170,7 +170,7 @@
public StaticGroup newInstance(Entry groupEntry)
throws DirectoryException
{
- ensureNotNull(groupEntry);
+ ifNull(groupEntry);
// Determine whether it is a groupOfNames, groupOfEntries or
@@ -300,7 +300,7 @@
@Override()
public boolean isGroupDefinition(Entry entry)
{
- ensureNotNull(entry);
+ ifNull(entry);
// FIXME -- This needs to exclude enhanced groups once we have support for
//them.
@@ -404,7 +404,7 @@
public void addNestedGroup(DN nestedGroupDN)
throws UnsupportedOperationException, DirectoryException
{
- ensureNotNull(nestedGroupDN);
+ ifNull(nestedGroupDN);
synchronized (this)
{
@@ -465,7 +465,7 @@
public void removeNestedGroup(DN nestedGroupDN)
throws UnsupportedOperationException, DirectoryException
{
- ensureNotNull(nestedGroupDN);
+ ifNull(nestedGroupDN);
synchronized (this)
{
@@ -672,7 +672,7 @@
public void addMember(Entry userEntry)
throws UnsupportedOperationException, DirectoryException
{
- ensureNotNull(userEntry);
+ ifNull(userEntry);
synchronized (this)
{
@@ -729,7 +729,7 @@
public void removeMember(DN userDN)
throws UnsupportedOperationException, DirectoryException
{
- ensureNotNull(userDN);
+ ifNull(userDN);
ByteString userDNString = ByteString.valueOf(userDN.toNormalizedString());
synchronized (this)
diff --git a/opendj3-server-dev/src/server/org/opends/server/extensions/VirtualStaticGroup.java b/opendj3-server-dev/src/server/org/opends/server/extensions/VirtualStaticGroup.java
index 931ffcd..0675799 100644
--- a/opendj3-server-dev/src/server/org/opends/server/extensions/VirtualStaticGroup.java
+++ b/opendj3-server-dev/src/server/org/opends/server/extensions/VirtualStaticGroup.java
@@ -56,7 +56,7 @@
import static org.opends.server.config.ConfigConstants.*;
import static org.opends.server.loggers.debug.DebugLogger.*;
import static org.opends.server.util.ServerConstants.*;
-import static org.opends.server.util.Validator.*;
+import static org.forgerock.util.Reject.*;
@@ -106,7 +106,7 @@
{
super();
- ensureNotNull(groupEntryDN, targetGroupDN);
+ ifNull(groupEntryDN, targetGroupDN);
this.groupEntryDN = groupEntryDN;
this.targetGroupDN = targetGroupDN;
@@ -135,7 +135,7 @@
public VirtualStaticGroup newInstance(Entry groupEntry)
throws DirectoryException
{
- ensureNotNull(groupEntry);
+ ifNull(groupEntry);
// Get the target group DN attribute from the entry, if there is one.
@@ -212,7 +212,7 @@
@Override()
public boolean isGroupDefinition(Entry entry)
{
- ensureNotNull(entry);
+ ifNull(entry);
// FIXME -- This needs to exclude enhanced groups once we have support for
//them.
diff --git a/opendj3-server-dev/src/server/org/opends/server/replication/server/ReplicationBackend.java b/opendj3-server-dev/src/server/org/opends/server/replication/server/ReplicationBackend.java
index 948f173..b9990c7 100644
--- a/opendj3-server-dev/src/server/org/opends/server/replication/server/ReplicationBackend.java
+++ b/opendj3-server-dev/src/server/org/opends/server/replication/server/ReplicationBackend.java
@@ -53,6 +53,7 @@
import org.opends.server.replication.server.changelog.api.DBCursor;
import org.opends.server.types.*;
import org.opends.server.util.*;
+import org.forgerock.util.Reject;
import static java.util.Collections.*;
@@ -148,7 +149,7 @@
{
if (config != null)
{
- Validator.ensureTrue(config instanceof BackendCfg);
+ Reject.ifFalse(config instanceof BackendCfg);
BackendCfg cfg = (BackendCfg) config;
DN[] newBaseDNs = new DN[cfg.getBaseDN().size()];
cfg.getBaseDN().toArray(newBaseDNs);
diff --git a/opendj3-server-dev/src/server/org/opends/server/schema/StringPrepProfile.java b/opendj3-server-dev/src/server/org/opends/server/schema/StringPrepProfile.java
index 840e8a7..50147d6 100644
--- a/opendj3-server-dev/src/server/org/opends/server/schema/StringPrepProfile.java
+++ b/opendj3-server-dev/src/server/org/opends/server/schema/StringPrepProfile.java
@@ -22,6 +22,7 @@
*
*
* Copyright 2009 Sun Microsystems, Inc.
+ * Portions Copyright 2014 ForgeRock AS
*/
@@ -32,7 +33,7 @@
import org.opends.server.types.ByteSequence;
-import static org.opends.server.util.Validator.*;
+import static org.forgerock.util.Reject.*;
import org.opends.server.util.Platform;
@@ -88,8 +89,8 @@
boolean trim,
boolean foldCase)
{
- ensureNotNull(buffer);
- ensureNotNull(sequence);
+ ifNull(buffer);
+ ifNull(sequence);
//Optimize in the case of purely ascii characters which is the most common
//case.
int length = sequence.length();
diff --git a/opendj3-server-dev/src/server/org/opends/server/tools/dsconfig/PropertyValueEditor.java b/opendj3-server-dev/src/server/org/opends/server/tools/dsconfig/PropertyValueEditor.java
index 1453f5b..19d2ba5 100644
--- a/opendj3-server-dev/src/server/org/opends/server/tools/dsconfig/PropertyValueEditor.java
+++ b/opendj3-server-dev/src/server/org/opends/server/tools/dsconfig/PropertyValueEditor.java
@@ -22,7 +22,7 @@
*
*
* Copyright 2008-2010 Sun Microsystems, Inc.
- * Portions Copyright 2013 ForgeRock AS
+ * Portions Copyright 2013-2014 ForgeRock AS
*/
package org.opends.server.tools.dsconfig;
@@ -76,7 +76,7 @@
import org.opends.server.admin.client.ManagementContext;
import org.opends.server.protocols.ldap.LDAPResultCode;
import org.opends.server.tools.ClientException;
-import org.opends.server.util.Validator;
+import org.forgerock.util.Reject;
import org.opends.server.util.cli.CLIException;
import org.opends.server.util.cli.ConsoleApplication;
import org.opends.server.util.cli.HelpCallback;
@@ -696,7 +696,7 @@
// Creates a new property editor for the specified property.
private MultiValuedPropertyEditor(ManagedObject<?> mo,
PropertyDefinition<?> pd) {
- Validator.ensureTrue(pd.hasOption(PropertyOption.MULTI_VALUED));
+ Reject.ifFalse(pd.hasOption(PropertyOption.MULTI_VALUED));
this.mo = mo;
this.pd = pd;
@@ -1599,7 +1599,7 @@
// Creates a new property editor for the specified property.
private SingleValuedPropertyEditor(ManagedObject<?> mo,
PropertyDefinition<?> pd) {
- Validator.ensureTrue(!pd.hasOption(PropertyOption.MULTI_VALUED));
+ Reject.ifFalse(!pd.hasOption(PropertyOption.MULTI_VALUED));
this.mo = mo;
this.pd = pd;
diff --git a/opendj3-server-dev/src/server/org/opends/server/types/AbstractOperation.java b/opendj3-server-dev/src/server/org/opends/server/types/AbstractOperation.java
index 643209a..0f29389 100644
--- a/opendj3-server-dev/src/server/org/opends/server/types/AbstractOperation.java
+++ b/opendj3-server-dev/src/server/org/opends/server/types/AbstractOperation.java
@@ -37,7 +37,7 @@
import org.opends.server.protocols.ldap.LDAPControl;
import org.opends.server.types.operation.PostResponseOperation;
import org.opends.server.types.operation.PreParseOperation;
-import org.opends.server.util.Validator;
+import org.forgerock.util.Reject;
import static org.opends.server.loggers.debug.DebugLogger.*;
@@ -407,7 +407,7 @@
@Override
public void addAdditionalLogItem(AdditionalLogItem item)
{
- Validator.ensureNotNull(item);
+ Reject.ifNull(item);
if (additionalLogItems == null)
{
additionalLogItems = new LinkedList<AdditionalLogItem>();
diff --git a/opendj3-server-dev/src/server/org/opends/server/types/AdditionalLogItem.java b/opendj3-server-dev/src/server/org/opends/server/types/AdditionalLogItem.java
index 69532a3..283db76 100644
--- a/opendj3-server-dev/src/server/org/opends/server/types/AdditionalLogItem.java
+++ b/opendj3-server-dev/src/server/org/opends/server/types/AdditionalLogItem.java
@@ -21,13 +21,13 @@
* CDDL HEADER END
*
*
- * Copyright 2011 ForgeRock AS
+ * Portions Copyright 2011-2014 ForgeRock AS
*/
package org.opends.server.types;
-import org.opends.server.util.Validator;
+import org.forgerock.util.Reject;
@@ -59,7 +59,7 @@
public static AdditionalLogItem keyOnly(final Class<?> source,
final String key)
{
- Validator.ensureNotNull(source, key);
+ Reject.ifNull(source, key);
return new AdditionalLogItem(source, key, null, false);
}
@@ -80,7 +80,7 @@
public static AdditionalLogItem quotedKeyValue(final Class<?> source,
final String key, final Object value)
{
- Validator.ensureNotNull(source, key, value);
+ Reject.ifNull(source, key, value);
return new AdditionalLogItem(source, key, value, true);
}
@@ -102,7 +102,7 @@
public static AdditionalLogItem unquotedKeyValue(final Class<?> source,
final String key, final Object value)
{
- Validator.ensureNotNull(source, key, value);
+ Reject.ifNull(source, key, value);
return new AdditionalLogItem(source, key, value, false);
}
diff --git a/opendj3-server-dev/src/server/org/opends/server/types/AttributeBuilder.java b/opendj3-server-dev/src/server/org/opends/server/types/AttributeBuilder.java
index 020e72e..d4ce5d6 100644
--- a/opendj3-server-dev/src/server/org/opends/server/types/AttributeBuilder.java
+++ b/opendj3-server-dev/src/server/org/opends/server/types/AttributeBuilder.java
@@ -22,7 +22,7 @@
*
*
* Copyright 2006-2010 Sun Microsystems, Inc.
- * Portions Copyright 2012-2013 ForgeRock AS
+ * Portions Copyright 2012-2014 ForgeRock AS
*/
package org.opends.server.types;
@@ -47,7 +47,7 @@
import org.opends.server.api.SubstringMatchingRule;
import org.opends.server.core.DirectoryServer;
import org.opends.server.loggers.debug.DebugTracer;
-import org.opends.server.util.Validator;
+import org.forgerock.util.Reject;
/**
@@ -1059,7 +1059,7 @@
public void setInitialCapacity(int initialCapacity)
throws IllegalStateException
{
- Validator.ensureTrue(initialCapacity >= 0);
+ Reject.ifFalse(initialCapacity >= 0);
if (elements != null)
{
@@ -1244,7 +1244,7 @@
*/
public AttributeBuilder(AttributeType attributeType, String name)
{
- Validator.ensureNotNull(attributeType, name);
+ Reject.ifNull(attributeType, name);
this.attributeType = attributeType;
this.name = name;
@@ -1610,7 +1610,7 @@
AttributeType attributeType,
String name)
{
- Validator.ensureNotNull(attributeType, name);
+ Reject.ifNull(attributeType, name);
this.attributeType = attributeType;
this.name = name;
diff --git a/opendj3-server-dev/src/server/org/opends/server/types/AttributeType.java b/opendj3-server-dev/src/server/org/opends/server/types/AttributeType.java
index aa4398e..911e96f 100644
--- a/opendj3-server-dev/src/server/org/opends/server/types/AttributeType.java
+++ b/opendj3-server-dev/src/server/org/opends/server/types/AttributeType.java
@@ -22,7 +22,7 @@
*
*
* Copyright 2006-2009 Sun Microsystems, Inc.
- * Portions Copyright 2011-2013 ForgeRock AS
+ * Portions Copyright 2011-2014 ForgeRock AS
*/
package org.opends.server.types;
@@ -42,7 +42,7 @@
import static org.opends.server.loggers.debug.DebugLogger.*;
import org.opends.server.loggers.debug.DebugTracer;
import static org.opends.server.util.ServerConstants.*;
-import static org.opends.server.util.Validator.*;
+import static org.forgerock.util.Reject.*;
@@ -276,7 +276,7 @@
extraProperties);
- ensureNotNull(definition, oid);
+ ifNull(definition, oid);
this.superiorType = superiorType;
this.isCollective = isCollective;
diff --git a/opendj3-server-dev/src/server/org/opends/server/types/AuthenticationInfo.java b/opendj3-server-dev/src/server/org/opends/server/types/AuthenticationInfo.java
index ddd6975..05a8a8e 100644
--- a/opendj3-server-dev/src/server/org/opends/server/types/AuthenticationInfo.java
+++ b/opendj3-server-dev/src/server/org/opends/server/types/AuthenticationInfo.java
@@ -26,7 +26,7 @@
*/
package org.opends.server.types;
-import static org.opends.server.util.Validator.*;
+import static org.forgerock.util.Reject.*;
/**
* This class defines a data structure that may be used to store
@@ -129,7 +129,7 @@
public AuthenticationInfo(Entry authenticationEntry, DN simpleBindDN,
boolean isRoot)
{
- ensureNotNull(authenticationEntry);
+ ifNull(authenticationEntry);
this.authenticationEntry = authenticationEntry;
this.simpleBindDN = simpleBindDN;
@@ -162,7 +162,7 @@
String saslMechanism,
boolean isRoot)
{
- ensureNotNull(authenticationEntry, saslMechanism);
+ ifNull(authenticationEntry, saslMechanism);
this.authenticationEntry = authenticationEntry;
this.isRoot = isRoot;
@@ -206,7 +206,7 @@
ByteString saslCredentials,
boolean isRoot)
{
- ensureNotNull(authenticationEntry, saslMechanism);
+ ifNull(authenticationEntry, saslMechanism);
this.authenticationEntry = authenticationEntry;
this.authorizationEntry = authorizationEntry;
diff --git a/opendj3-server-dev/src/server/org/opends/server/types/CommonSchemaElements.java b/opendj3-server-dev/src/server/org/opends/server/types/CommonSchemaElements.java
index 23f072f..6f77762 100644
--- a/opendj3-server-dev/src/server/org/opends/server/types/CommonSchemaElements.java
+++ b/opendj3-server-dev/src/server/org/opends/server/types/CommonSchemaElements.java
@@ -22,7 +22,7 @@
*
*
* Copyright 2006-2009 Sun Microsystems, Inc.
- * Portions Copyright 2013 ForgeRock AS
+ * Portions Copyright 2013-2014 ForgeRock AS
*/
package org.opends.server.types;
@@ -30,7 +30,7 @@
import static org.opends.messages.SchemaMessages.*;
import static org.opends.server.util.ServerConstants.*;
import static org.opends.server.util.StaticUtils.toLowerCase;
-import static org.opends.server.util.Validator.*;
+import static org.forgerock.util.Reject.*;
import java.util.Collection;
import java.util.Collections;
@@ -467,7 +467,7 @@
*/
public final void setExtraProperty(String name, String value) {
- ensureNotNull(name);
+ ifNull(name);
if (value == null)
{
@@ -500,7 +500,7 @@
public final void setExtraProperty(String name,
List<String> values) {
- ensureNotNull(name);
+ ifNull(name);
if ((values == null) || values.isEmpty())
{
diff --git a/opendj3-server-dev/src/server/org/opends/server/types/DITContentRule.java b/opendj3-server-dev/src/server/org/opends/server/types/DITContentRule.java
index 4d213ec..be8bcbf 100644
--- a/opendj3-server-dev/src/server/org/opends/server/types/DITContentRule.java
+++ b/opendj3-server-dev/src/server/org/opends/server/types/DITContentRule.java
@@ -22,7 +22,7 @@
*
*
* Copyright 2006-2008 Sun Microsystems, Inc.
- * Portions copyright 2013 ForgeRock AS.
+ * Portions Copyright 2013-2014 ForgeRock AS.
*/
package org.opends.server.types;
@@ -41,7 +41,7 @@
import static org.opends.server.loggers.debug.DebugLogger.*;
import org.opends.server.loggers.debug.DebugTracer;
import static org.opends.server.util.ServerConstants.*;
-import static org.opends.server.util.Validator.*;
+import static org.forgerock.util.Reject.*;
@@ -137,7 +137,7 @@
boolean isObsolete,
Map<String,List<String>> extraProperties)
{
- ensureNotNull(definition, structuralClass);
+ ifNull(definition, structuralClass);
this.structuralClass = structuralClass;
this.description = description;
@@ -618,7 +618,7 @@
*/
public void setExtraProperty(String name, String value)
{
- ensureNotNull(name);
+ ifNull(name);
if (value == null)
{
@@ -646,7 +646,7 @@
*/
public void setExtraProperty(String name, List<String> values)
{
- ensureNotNull(name);
+ ifNull(name);
if ((values == null) || values.isEmpty())
{
diff --git a/opendj3-server-dev/src/server/org/opends/server/types/DITStructureRule.java b/opendj3-server-dev/src/server/org/opends/server/types/DITStructureRule.java
index 772de0d..4a4c2f9 100644
--- a/opendj3-server-dev/src/server/org/opends/server/types/DITStructureRule.java
+++ b/opendj3-server-dev/src/server/org/opends/server/types/DITStructureRule.java
@@ -22,7 +22,7 @@
*
*
* Copyright 2006-2008 Sun Microsystems, Inc.
- * Portions copyright 2013 ForgeRock AS.
+ * Portions Copyright 2013-2014 ForgeRock AS.
*/
package org.opends.server.types;
@@ -41,7 +41,7 @@
import static org.opends.server.loggers.debug.DebugLogger.*;
import org.opends.server.loggers.debug.DebugTracer;
import static org.opends.server.util.ServerConstants.*;
-import static org.opends.server.util.Validator.*;
+import static org.forgerock.util.Reject.*;
@@ -117,7 +117,7 @@
Set<DITStructureRule> superiorRules,
Map<String,List<String>> extraProperties)
{
- ensureNotNull(definition);
+ ifNull(definition);
this.ruleID = ruleID;
this.description = description;
@@ -440,7 +440,7 @@
*/
public void setExtraProperty(String name, String value)
{
- ensureNotNull(name);
+ ifNull(name);
if (value == null)
{
@@ -468,7 +468,7 @@
*/
public void setExtraProperty(String name, List<String> values)
{
- ensureNotNull(name);
+ ifNull(name);
if ((values == null) || values.isEmpty())
{
diff --git a/opendj3-server-dev/src/server/org/opends/server/types/DN.java b/opendj3-server-dev/src/server/org/opends/server/types/DN.java
index 3b76481..40d38e3 100644
--- a/opendj3-server-dev/src/server/org/opends/server/types/DN.java
+++ b/opendj3-server-dev/src/server/org/opends/server/types/DN.java
@@ -38,7 +38,7 @@
import static org.opends.server.config.ConfigConstants.*;
import static org.opends.server.loggers.debug.DebugLogger.*;
import static org.opends.server.util.StaticUtils.*;
-import static org.opends.server.util.Validator.*;
+import static org.forgerock.util.Reject.*;
/**
* This class defines a data structure for storing and interacting
@@ -174,7 +174,7 @@
*/
public DN(RDN rdn, DN parentDN)
{
- ensureNotNull(rdn, parentDN);
+ ifNull(rdn, parentDN);
if (parentDN.isRootDN())
{
rdnComponents = new RDN[] { rdn };
diff --git a/opendj3-server-dev/src/server/org/opends/server/types/LDAPSyntaxDescription.java b/opendj3-server-dev/src/server/org/opends/server/types/LDAPSyntaxDescription.java
index 2a5ac8b..245c9d6 100644
--- a/opendj3-server-dev/src/server/org/opends/server/types/LDAPSyntaxDescription.java
+++ b/opendj3-server-dev/src/server/org/opends/server/types/LDAPSyntaxDescription.java
@@ -22,7 +22,7 @@
*
*
* Copyright 2009 Sun Microsystems, Inc.
- * Portions copyright 2013 ForgeRock AS.
+ * Portions Copyright 2013-2014 ForgeRock AS.
*/
@@ -37,7 +37,7 @@
import org.opends.server.schema.LDAPSyntaxDescriptionSyntax;
import static org.opends.server.util.ServerConstants.*;
-import static org.opends.server.util.Validator.*;
+import static org.forgerock.util.Reject.*;
@@ -92,7 +92,7 @@
String description,
Map<String,List<String>> extraProperties)
{
- ensureNotNull(definition,descriptionSyntax);
+ ifNull(definition,descriptionSyntax);
this.descriptionSyntax = descriptionSyntax;
this.oid = descriptionSyntax.getOID();
@@ -277,7 +277,7 @@
*/
public void setExtraProperty(String name, String value)
{
- ensureNotNull(name);
+ ifNull(name);
if (value == null)
{
@@ -305,7 +305,7 @@
*/
public void setExtraProperty(String name, List<String> values)
{
- ensureNotNull(name);
+ ifNull(name);
if ((values == null) || values.isEmpty())
{
diff --git a/opendj3-server-dev/src/server/org/opends/server/types/MatchingRuleUse.java b/opendj3-server-dev/src/server/org/opends/server/types/MatchingRuleUse.java
index 2a8eb8e..dbd1d04 100644
--- a/opendj3-server-dev/src/server/org/opends/server/types/MatchingRuleUse.java
+++ b/opendj3-server-dev/src/server/org/opends/server/types/MatchingRuleUse.java
@@ -22,7 +22,7 @@
*
*
* Copyright 2006-2008 Sun Microsystems, Inc.
- * Portions copyright 2013 ForgeRock AS.
+ * Portions Copyright 2013-2014 ForgeRock AS.
*/
package org.opends.server.types;
@@ -42,7 +42,7 @@
import static org.opends.server.loggers.debug.DebugLogger.*;
import org.opends.server.loggers.debug.DebugTracer;
import static org.opends.server.util.ServerConstants.*;
-import static org.opends.server.util.Validator.*;
+import static org.forgerock.util.Reject.*;
@@ -119,7 +119,7 @@
Set<AttributeType> attributes,
Map<String,List<String>> extraProperties)
{
- ensureNotNull(definition, matchingRule);
+ ifNull(definition, matchingRule);
this.matchingRule = matchingRule;
this.description = description;
@@ -419,7 +419,7 @@
*/
public void setExtraProperty(String name, String value)
{
- ensureNotNull(name);
+ ifNull(name);
if (value == null)
{
@@ -447,7 +447,7 @@
*/
public void setExtraProperty(String name, List<String> values)
{
- ensureNotNull(name);
+ ifNull(name);
if ((values == null) || values.isEmpty())
{
diff --git a/opendj3-server-dev/src/server/org/opends/server/types/NameForm.java b/opendj3-server-dev/src/server/org/opends/server/types/NameForm.java
index 646cdaf..e60e7f2 100644
--- a/opendj3-server-dev/src/server/org/opends/server/types/NameForm.java
+++ b/opendj3-server-dev/src/server/org/opends/server/types/NameForm.java
@@ -22,7 +22,7 @@
*
*
* Copyright 2006-2008 Sun Microsystems, Inc.
- * Portions copyright 2013 ForgeRock AS.
+ * Portions Copyright 2013-2014 ForgeRock AS.
*/
package org.opends.server.types;
@@ -41,7 +41,7 @@
import static org.opends.server.loggers.debug.DebugLogger.*;
import org.opends.server.loggers.debug.DebugTracer;
import static org.opends.server.util.ServerConstants.*;
-import static org.opends.server.util.Validator.*;
+import static org.forgerock.util.Reject.*;
@@ -125,7 +125,7 @@
Set<AttributeType> optionalAttributes,
Map<String,List<String>> extraProperties)
{
- ensureNotNull(definition, oid, structuralClass);
+ ifNull(definition, oid, structuralClass);
this.oid = oid;
this.description = description;
@@ -519,7 +519,7 @@
*/
public void setExtraProperty(String name, String value)
{
- ensureNotNull(name);
+ ifNull(name);
if (value == null)
{
@@ -546,7 +546,7 @@
*/
public void setExtraProperty(String name, List<String> values)
{
- ensureNotNull(name);
+ ifNull(name);
if ((values == null) || values.isEmpty())
{
diff --git a/opendj3-server-dev/src/server/org/opends/server/types/ObjectClass.java b/opendj3-server-dev/src/server/org/opends/server/types/ObjectClass.java
index 06dc6b0..d429e9c 100644
--- a/opendj3-server-dev/src/server/org/opends/server/types/ObjectClass.java
+++ b/opendj3-server-dev/src/server/org/opends/server/types/ObjectClass.java
@@ -22,7 +22,7 @@
*
*
* Copyright 2006-2010 Sun Microsystems, Inc.
- * Portions copyright 2013 ForgeRock AS.
+ * Portions Copyright 2013-2014 ForgeRock AS.
*/
package org.opends.server.types;
@@ -42,7 +42,7 @@
import static org.opends.server.loggers.debug.DebugLogger.*;
import org.opends.server.loggers.debug.DebugTracer;
import static org.opends.server.util.ServerConstants.*;
-import static org.opends.server.util.Validator.*;
+import static org.forgerock.util.Reject.*;
@@ -167,7 +167,7 @@
extraProperties);
- ensureNotNull(definition, oid);
+ ifNull(definition, oid);
// Construct unmodifiable views of the superior classes.
if (superiorClasses != null) {
diff --git a/opendj3-server-dev/src/server/org/opends/server/types/RawAttribute.java b/opendj3-server-dev/src/server/org/opends/server/types/RawAttribute.java
index e2c18c0..98ffbca 100644
--- a/opendj3-server-dev/src/server/org/opends/server/types/RawAttribute.java
+++ b/opendj3-server-dev/src/server/org/opends/server/types/RawAttribute.java
@@ -22,14 +22,14 @@
*
*
* Copyright 2006-2009 Sun Microsystems, Inc.
- * Portions copyright 2013 ForgeRock AS
+ * Portions Copyright 2013-2014 ForgeRock AS
*/
package org.opends.server.types;
import static org.opends.messages.ProtocolMessages.*;
import static org.opends.server.loggers.debug.DebugLogger.*;
import static org.opends.server.protocols.ldap.LDAPResultCode.*;
-import static org.opends.server.util.Validator.*;
+import static org.forgerock.util.Reject.*;
import java.io.IOException;
import java.util.ArrayList;
@@ -71,7 +71,7 @@
*/
public static RawAttribute create(String attributeType)
{
- ensureNotNull(attributeType);
+ ifNull(attributeType);
return new LDAPAttribute(attributeType);
}
@@ -91,7 +91,7 @@
public static RawAttribute create(String attributeType,
String value)
{
- ensureNotNull(attributeType, value);
+ ifNull(attributeType, value);
return new LDAPAttribute(attributeType, value);
}
@@ -111,7 +111,7 @@
public static RawAttribute create(String attributeType,
ByteString value)
{
- ensureNotNull(attributeType);
+ ifNull(attributeType);
return new LDAPAttribute(attributeType, value);
}
@@ -130,7 +130,7 @@
public static RawAttribute create(String attributeType,
ArrayList<ByteString> values)
{
- ensureNotNull(attributeType);
+ ifNull(attributeType);
return new LDAPAttribute(attributeType, values);
}
@@ -147,7 +147,7 @@
*/
public static RawAttribute create(Attribute attribute)
{
- ensureNotNull(attribute);
+ ifNull(attribute);
return new LDAPAttribute(attribute);
}
diff --git a/opendj3-server-dev/src/server/org/opends/server/types/ResultCode.java b/opendj3-server-dev/src/server/org/opends/server/types/ResultCode.java
index e80fa68..22fe4c7 100644
--- a/opendj3-server-dev/src/server/org/opends/server/types/ResultCode.java
+++ b/opendj3-server-dev/src/server/org/opends/server/types/ResultCode.java
@@ -22,13 +22,14 @@
*
*
* Copyright 2006-2010 Sun Microsystems, Inc.
+ * Portions Copyright 2014 ForgeRock AS
*/
package org.opends.server.types;
import org.opends.messages.Message;
import org.opends.server.protocols.ldap.LDAPResultCode;
-import org.opends.server.util.Validator;
+import org.forgerock.util.Reject;
import static org.opends.messages.CoreMessages.*;
@@ -705,7 +706,7 @@
*/
private ResultCode(int intValue, Message name)
{
- Validator.ensureNotNull(name);
+ Reject.ifNull(name);
this.intValue = intValue;
this.resultCodeName = name;
}
diff --git a/opendj3-server-dev/src/server/org/opends/server/types/VirtualAttributeRule.java b/opendj3-server-dev/src/server/org/opends/server/types/VirtualAttributeRule.java
index 4b13487..6160cb6 100644
--- a/opendj3-server-dev/src/server/org/opends/server/types/VirtualAttributeRule.java
+++ b/opendj3-server-dev/src/server/org/opends/server/types/VirtualAttributeRule.java
@@ -38,7 +38,7 @@
import static org.opends.server.loggers.debug.DebugLogger.*;
import static org.opends.server.util.StaticUtils.*;
-import static org.opends.server.util.Validator.*;
+import static org.forgerock.util.Reject.*;
/**
* This class defines a virtual attribute rule, which associates a
@@ -130,8 +130,8 @@
VirtualAttributeCfgDefn.ConflictBehavior
conflictBehavior)
{
- ensureNotNull(attributeType, provider, baseDNs, groupDNs);
- ensureNotNull(filters, conflictBehavior);
+ ifNull(attributeType, provider, baseDNs, groupDNs);
+ ifNull(filters, conflictBehavior);
this.attributeType = attributeType;
this.provider = provider;
diff --git a/opendj3-server-dev/src/server/org/opends/server/util/AddChangeRecordEntry.java b/opendj3-server-dev/src/server/org/opends/server/util/AddChangeRecordEntry.java
index dec7eb3..906da95 100644
--- a/opendj3-server-dev/src/server/org/opends/server/util/AddChangeRecordEntry.java
+++ b/opendj3-server-dev/src/server/org/opends/server/util/AddChangeRecordEntry.java
@@ -22,10 +22,11 @@
*
*
* Copyright 2006-2008 Sun Microsystems, Inc.
+ * Portions Copyright 2014 ForgeRock AS
*/
package org.opends.server.util;
-import static org.opends.server.util.Validator.*;
+import static org.forgerock.util.Reject.*;
import java.util.ArrayList;
import java.util.Collections;
@@ -75,7 +76,7 @@
super(dn);
- ensureNotNull(attributes);
+ ifNull(attributes);
this.attributes = new ArrayList<Attribute>(attributes.size());
diff --git a/opendj3-server-dev/src/server/org/opends/server/util/Base64.java b/opendj3-server-dev/src/server/org/opends/server/util/Base64.java
index 035af58..304f84a 100644
--- a/opendj3-server-dev/src/server/org/opends/server/util/Base64.java
+++ b/opendj3-server-dev/src/server/org/opends/server/util/Base64.java
@@ -22,6 +22,7 @@
*
*
* Copyright 2006-2009 Sun Microsystems, Inc.
+ * Portions Copyright 2014 ForgeRock AS
*/
package org.opends.server.util;
@@ -56,7 +57,7 @@
import static org.opends.messages.UtilityMessages.*;
import static org.opends.messages.ToolMessages.*;
import static org.opends.server.util.StaticUtils.*;
-import static org.opends.server.util.Validator.*;
+import static org.forgerock.util.Reject.*;
@@ -96,7 +97,7 @@
*/
public static String encode(byte[] rawData)
{
- ensureNotNull(rawData);
+ ifNull(rawData);
StringBuilder buffer = new StringBuilder(4 * rawData.length / 3);
@@ -143,7 +144,7 @@
*/
public static String encode(ByteSequence rawData)
{
- ensureNotNull(rawData);
+ ifNull(rawData);
StringBuilder buffer = new StringBuilder(4 * rawData.length() / 3);
@@ -199,7 +200,7 @@
public static byte[] decode(String encodedData)
throws ParseException
{
- ensureNotNull(encodedData);
+ ifNull(encodedData);
// The encoded value must have length that is a multiple of four bytes.
diff --git a/opendj3-server-dev/src/server/org/opends/server/util/ChangeRecordEntry.java b/opendj3-server-dev/src/server/org/opends/server/util/ChangeRecordEntry.java
index e8f6825..a3ce472 100644
--- a/opendj3-server-dev/src/server/org/opends/server/util/ChangeRecordEntry.java
+++ b/opendj3-server-dev/src/server/org/opends/server/util/ChangeRecordEntry.java
@@ -22,10 +22,11 @@
*
*
* Copyright 2006-2008 Sun Microsystems, Inc.
+ * Portions Copyright 2014 ForgeRock AS
*/
package org.opends.server.util;
-import static org.opends.server.util.Validator.*;
+import static org.forgerock.util.Reject.*;
import org.opends.server.types.DN;
@@ -55,7 +56,7 @@
*/
protected ChangeRecordEntry(DN dn)
{
- ensureNotNull(dn);
+ ifNull(dn);
this.dn = dn;
}
diff --git a/opendj3-server-dev/src/server/org/opends/server/util/LDIFReader.java b/opendj3-server-dev/src/server/org/opends/server/util/LDIFReader.java
index b28a110..3793e70 100644
--- a/opendj3-server-dev/src/server/org/opends/server/util/LDIFReader.java
+++ b/opendj3-server-dev/src/server/org/opends/server/util/LDIFReader.java
@@ -30,7 +30,7 @@
import static org.opends.server.loggers.ErrorLogger.*;
import static org.opends.server.loggers.debug.DebugLogger.*;
import static org.opends.server.util.StaticUtils.*;
-import static org.opends.server.util.Validator.*;
+import static org.forgerock.util.Reject.*;
import java.io.*;
import java.net.URL;
@@ -131,7 +131,7 @@
public LDIFReader(LDIFImportConfig importConfig)
throws IOException
{
- ensureNotNull(importConfig);
+ ifNull(importConfig);
this.importConfig = importConfig;
reader = importConfig.getReader();
@@ -165,7 +165,7 @@
public LDIFReader(LDIFImportConfig importConfig, RootContainer rootContainer)
throws IOException
{
- ensureNotNull(importConfig);
+ ifNull(importConfig);
this.importConfig = importConfig;
this.reader = importConfig.getReader();
this.lineNumber = 0;
diff --git a/opendj3-server-dev/src/server/org/opends/server/util/LDIFWriter.java b/opendj3-server-dev/src/server/org/opends/server/util/LDIFWriter.java
index ea1c66c..e9050ac 100644
--- a/opendj3-server-dev/src/server/org/opends/server/util/LDIFWriter.java
+++ b/opendj3-server-dev/src/server/org/opends/server/util/LDIFWriter.java
@@ -39,7 +39,7 @@
import org.opends.server.types.*;
import static org.opends.server.util.StaticUtils.*;
-import static org.opends.server.util.Validator.*;
+import static org.forgerock.util.Reject.*;
/**
* This class provides a mechanism for writing entries in LDIF form to a file or
@@ -77,7 +77,7 @@
public LDIFWriter(LDIFExportConfig exportConfig)
throws IOException
{
- ensureNotNull(exportConfig);
+ ifNull(exportConfig);
this.exportConfig = exportConfig;
writer = exportConfig.getWriter();
@@ -112,7 +112,7 @@
public void writeComment(Message comment, int wrapColumn)
throws IOException
{
- ensureNotNull(comment);
+ ifNull(comment);
// First, break up the comment into multiple lines to preserve the original
@@ -235,7 +235,7 @@
public boolean writeEntry(Entry entry)
throws IOException, LDIFException
{
- ensureNotNull(entry);
+ ifNull(entry);
return entry.toLDIF(exportConfig);
}
@@ -260,7 +260,7 @@
public boolean writeTemplateEntry(TemplateEntry templateEntry)
throws IOException, LDIFException
{
- ensureNotNull(templateEntry);
+ ifNull(templateEntry);
return templateEntry.toLDIF(exportConfig);
}
@@ -274,7 +274,7 @@
public void writeChangeRecord(ChangeRecordEntry changeRecord)
throws IOException
{
- ensureNotNull(changeRecord);
+ ifNull(changeRecord);
// Get the information necessary to write the LDIF.
@@ -399,7 +399,7 @@
public void writeAddChangeRecord(Entry entry)
throws IOException
{
- ensureNotNull(entry);
+ ifNull(entry);
// Get the information necessary to write the LDIF.
@@ -469,7 +469,7 @@
public void writeDeleteChangeRecord(Entry entry, boolean commentEntry)
throws IOException
{
- ensureNotNull(entry);
+ ifNull(entry);
// Get the information necessary to write the LDIF.
BufferedWriter writer = exportConfig.getWriter();
@@ -540,7 +540,7 @@
public void writeModifyChangeRecord(DN dn, List<Modification> modifications)
throws IOException
{
- ensureNotNull(dn, modifications);
+ ifNull(dn, modifications);
// If there aren't any modifications, then there's nothing to do.
if (modifications.isEmpty())
@@ -621,7 +621,7 @@
DN newSuperior)
throws IOException
{
- ensureNotNull(dn, newRDN);
+ ifNull(dn, newRDN);
// Get the information necessary to write the LDIF.
@@ -750,7 +750,7 @@
public static void appendLDIFSeparatorAndValue(StringBuilder buffer,
ByteSequence valueBytes, boolean isURL, boolean isBase64)
{
- ensureNotNull(buffer, valueBytes);
+ ifNull(buffer, valueBytes);
// If the value is empty, then just append a single colon (the URL '<' if
@@ -805,7 +805,7 @@
boolean wrapLines, int wrapColumn)
throws IOException
{
- ensureNotNull(line, writer);
+ ifNull(line, writer);
int length = line.length();
if (wrapLines && length > wrapColumn)
diff --git a/opendj3-server-dev/src/server/org/opends/server/util/LevenshteinDistance.java b/opendj3-server-dev/src/server/org/opends/server/util/LevenshteinDistance.java
index b1c4d9f..e873ce2 100644
--- a/opendj3-server-dev/src/server/org/opends/server/util/LevenshteinDistance.java
+++ b/opendj3-server-dev/src/server/org/opends/server/util/LevenshteinDistance.java
@@ -22,12 +22,13 @@
*
*
* Copyright 2008 Sun Microsystems, Inc.
+ * Portions Copyright 2014 ForgeRock AS
*/
package org.opends.server.util;
-import static org.opends.server.util.Validator.*;
+import static org.forgerock.util.Reject.*;
@@ -92,7 +93,7 @@
*/
public static int calculate(String source, String target)
{
- ensureNotNull(source, target);
+ ifNull(source, target);
// sl == source length; tl == target length
int sl = source.length();
diff --git a/opendj3-server-dev/src/server/org/opends/server/util/ModifyChangeRecordEntry.java b/opendj3-server-dev/src/server/org/opends/server/util/ModifyChangeRecordEntry.java
index b524a88..3a07ed5 100644
--- a/opendj3-server-dev/src/server/org/opends/server/util/ModifyChangeRecordEntry.java
+++ b/opendj3-server-dev/src/server/org/opends/server/util/ModifyChangeRecordEntry.java
@@ -22,10 +22,11 @@
*
*
* Copyright 2006-2008 Sun Microsystems, Inc.
+ * Portions Copyright 2014 ForgeRock AS
*/
package org.opends.server.util;
-import static org.opends.server.util.Validator.*;
+import static org.forgerock.util.Reject.*;
import java.util.ArrayList;
import java.util.Collection;
@@ -71,7 +72,7 @@
super(dn);
- ensureNotNull(modifications);
+ ifNull(modifications);
this.modifications = new ArrayList<RawModification>(modifications);
}
diff --git a/opendj3-server-dev/src/server/org/opends/server/util/ModifyDNChangeRecordEntry.java b/opendj3-server-dev/src/server/org/opends/server/util/ModifyDNChangeRecordEntry.java
index aaae37f..fde4249 100644
--- a/opendj3-server-dev/src/server/org/opends/server/util/ModifyDNChangeRecordEntry.java
+++ b/opendj3-server-dev/src/server/org/opends/server/util/ModifyDNChangeRecordEntry.java
@@ -22,10 +22,11 @@
*
*
* Copyright 2006-2008 Sun Microsystems, Inc.
+ * Portions Copyright 2014 ForgeRock AS
*/
package org.opends.server.util;
-import static org.opends.server.util.Validator.*;
+import static org.forgerock.util.Reject.*;
import org.opends.server.types.DN;
import org.opends.server.types.RDN;
@@ -73,7 +74,7 @@
{
super(dn);
- ensureNotNull(newRDN);
+ ifNull(newRDN);
this.newSuperiorDN = newSuperiorDN;
this.newRDN = newRDN;
diff --git a/opendj3-server-dev/src/server/org/opends/server/util/MultiOutputStream.java b/opendj3-server-dev/src/server/org/opends/server/util/MultiOutputStream.java
index 9f5f0dd..4d65e63 100644
--- a/opendj3-server-dev/src/server/org/opends/server/util/MultiOutputStream.java
+++ b/opendj3-server-dev/src/server/org/opends/server/util/MultiOutputStream.java
@@ -22,6 +22,7 @@
*
*
* Copyright 2006-2008 Sun Microsystems, Inc.
+ * Portions Copyright 2014 ForgeRock AS
*/
package org.opends.server.util;
@@ -30,6 +31,8 @@
import java.io.OutputStream;
import static org.opends.server.loggers.debug.DebugLogger.*;
+
+import org.forgerock.util.Reject;
import org.opends.server.loggers.debug.DebugTracer;
import org.opends.server.types.DebugLogLevel;
@@ -69,7 +72,7 @@
*/
public MultiOutputStream(OutputStream... targetStreams)
{
- Validator.ensureNotNull(targetStreams);
+ Reject.ifNull(targetStreams);
this.targetStreams = targetStreams;
}
diff --git a/opendj3-server-dev/src/server/org/opends/server/util/StaticUtils.java b/opendj3-server-dev/src/server/org/opends/server/util/StaticUtils.java
index 0be4444..00916bb 100644
--- a/opendj3-server-dev/src/server/org/opends/server/util/StaticUtils.java
+++ b/opendj3-server-dev/src/server/org/opends/server/util/StaticUtils.java
@@ -43,6 +43,7 @@
import javax.naming.NamingException;
import javax.naming.ldap.InitialLdapContext;
+import org.forgerock.util.Reject;
import org.opends.messages.Message;
import org.opends.messages.MessageBuilder;
import org.opends.messages.MessageDescriptor;
@@ -165,7 +166,7 @@
*/
public static String decodeUTF8(final byte[] bytes)
{
- Validator.ensureNotNull(bytes);
+ Reject.ifNull(bytes);
if (bytes.length == 0)
{
@@ -3937,7 +3938,7 @@
*/
public static String wrapText(String text, int width, int indent)
{
- Validator.ensureTrue(indent >= 0 && indent < width);
+ Reject.ifFalse(indent >= 0 && indent < width);
// Calculate the real width and indentation padding.
width -= indent;
diff --git a/opendj3-server-dev/src/server/org/opends/server/util/Validator.java b/opendj3-server-dev/src/server/org/opends/server/util/Validator.java
deleted file mode 100644
index ac0afeb..0000000
--- a/opendj3-server-dev/src/server/org/opends/server/util/Validator.java
+++ /dev/null
@@ -1,473 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
- * or http://forgerock.org/license/CDDLv1.0.html.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at legal-notices/CDDLv1_0.txt.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information:
- * Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- *
- *
- * Copyright 2006-2008 Sun Microsystems, Inc.
- */
-package org.opends.server.util;
-import org.opends.messages.Message;
-
-import static org.opends.server.loggers.debug.DebugLogger.*;
-import org.opends.server.loggers.debug.DebugTracer;
-import org.opends.server.loggers.ErrorLogger;
-
-/**
- * This utility class provides static methods that make parameter checking
- * easier (e.g. in constructors and setters).
- * In particular the ensureNotNull methods provide an easy way to validate that
- * certain parameters are not null, and the ensureTrue methods provide the
- * ability to check arbitrary boolean conditions.
- * <p>
- * Invocation of these methods should be limited to situations where the only
- * way that they should fail is if there is a defect somewhere in the
- * system (including 3rd-party plugins).
- * <p>
- * You can think of these methods as being similar to <code>assert</code>,
- * but there are some additional advantages:
- * <ul>
- * <li>All failures are logged to the debug and error logs</li>
- * <li>Checks are always enabled (even if asserts are off)</li>
- * <li>This class tracks the number of failures, allowing it to
- * be exposed via monitoring, etc.<li>
- * <li>The unit tests can track unnoticed internal failures and
- * report on them.</li>
- * <li>Developers can catch all Validator failures with a single
- * break point.</li>
- * </ul>
- *
- * In general, you should not worry about the performance impact of calling
- * these methods. Some micro-benchmarking has shown that ensureNotNull can be
- * called 200M times per second on a single CPU laptop. The value of catching
- * defects early will almost always out-weigh any overhead that is introduced.
- * There are a couple of exceptions to this. Any execution overhead that
- * happens before the method is invoked cannot be eliminated, e.g.
- * <code>Validator.ensureTrue(someExpensiveCheck())</code> will always invoke
- * <code>someExpensiveCheck()</code>. When this code is on the critical path,
- * and we do not expect the validation to fail, you can guard the call with
- * an <code>assert</code> because each method returns true, and this code will
- * only be executed when asserts are enabled.
- * <p>
- * These methods are provided primarily to check parameter values for
- * constructors, setters, etc, and when they are used in this way, the javadoc
- * for the method must be updated to reflect what constraints are placed on the
- * parameters (e.g. attributeType cannot be null).
- * <p>
- * Feel free to add any method to this class that makes sense. Be sure to
- * ensure that they don't violate the spirit of this class in that performance
- * is second only to correctness.
- * <p>
- * There are a few issues open for remaining tasks:
- * <ul>
- * <li>757 Validator should expose a way to turn it off</li>
- * <li>758 Validator should provide a way to throttle it's error messages</li>
- * <li>759 Unit tests should always check that no unexpected Validator checks
- * failed</li>
- * </ul>
- */
-@org.opends.server.types.PublicAPI(
- stability=org.opends.server.types.StabilityLevel.UNCOMMITTED,
- mayInstantiate=false,
- mayExtend=false,
- mayInvoke=true)
-public class Validator {
- /**
- * The tracer object for the debug logger.
- */
- private static final DebugTracer TRACER = getTracer();
-
- /** This static final variable theoretically allows us to compile out all of
- * these checks. Since all of the code below is guarded with this check,
- * the compiler should eliminate it if ENABLE_CHECKS is false.
- * From doing a little bit of micro-benchmarking, it appears that setting
- * ENABLE_CHECKS=false speeds the code up by about a factor of four, but
- * it's still not the same as not having the invocation in the first place.
- * On a single CPU laptop, I was able to get 200M
- * invocations per second with ENABLE_CHECKS=true, and 350M with
- * ENABLE_CHECKS=false.
- * <p>
- * Setting this to false, will not eliminate any expensive computation
- * done in a parameter list (e.g. some self-check that returns true).*/
- public static final boolean ENABLE_CHECKS = true;
-
-
-
-
- /** A one-based array for parameter descriptions. */
- private static final String[] PARAM_DESCRIPTIONS =
- {"** A ZERO-BASED INDEX IS INVALID **",
- "(1st parameter)",
- "(2nd parameter)",
- "(3rd parameter)",
- "(4th parameter)",
- "(5th parameter)",
- "(6th parameter)",
- "(7th parameter)",
- "(8th parameter)",
- "(9th parameter)",
- "(10th parameter)"};
-
- /** A count of the errors detected by the methods in this class since the
- * last time that resetErrorCount was called. */
- private static long _errorCount = 0;
-
-
- /**
- * This method validates that the specified parameter is not null. It
- * throws an AssertionError if it is null after logging this error.
- * <p>
- * This should be used like an assert, except it is not turned
- * off at runtime. That is, it should only be used in situations where
- * there is a bug in someone's code if param is null.
- *
- * @param param the parameter to validate as non-null.
- * @return true always. This allows this call to be used in an assert
- * statement, which can skip this check and remove all
- * overhead from the calling code. This idiom should only be used when
- * performance testing proves that it is necessary.
- *
- * @throws AssertionError if and only if param is null
- * if assertions are enabled
- */
- public static boolean ensureNotNull(Object param)
- throws AssertionError {
- if (ENABLE_CHECKS) {
- if (param == null) throwNull("");
- }
- return true;
- }
-
-
-
- /**
- * This method validates that the specified parameters are not null. It
- * throws an AssertionError if one of them are null after logging this error.
- * It's similar to the ensureNotNull(Object) call except it provides the
- * convenience of checking two parameters at once.
- * <p>
- * This should be used like an assert, except it is not turned
- * off at runtime. That is, it should only be used in situations where
- * there is a bug in someone's code if param is null.
- * <p>
- * See the class level javadoc for why we did not use varargs to
- * implement this method.
- *
- * @param param1 the first parameter to validate as non-null.
- * @param param2 the second parameter to validate as non-null.
- * @return true always. This allows this call to be used in an assert
- * statement, which can skip this check and remove all
- * overhead from the calling code. This idiom should only be used when
- * performance testing proves that it is necessary.
- *
- * @throws AssertionError if and only if any of the parameters is null
- */
- public static boolean ensureNotNull(Object param1, Object param2)
- throws AssertionError {
- if (ENABLE_CHECKS) {
- if (param1 == null) throwNull(PARAM_DESCRIPTIONS[1]);
- if (param2 == null) throwNull(PARAM_DESCRIPTIONS[2]);
- }
- return true;
- }
-
-
-
- /**
- * This method validates that the specified parameters are not null. It
- * throws an AssertionError if one of them are null after logging this error.
- * It's similar to the ensureNotNull(Object) call except it provides the
- * convenience of checking three parameters at once.
- * <p>
- * This should be used like an assert, except it is not turned
- * off at runtime. That is, it should only be used in situations where
- * there is a bug in someone's code if param is null.
- * <p>
- * See the class level javadoc for why we did not use varargs to
- * implement this method.
- *
- * @param param1 the first parameter to validate as non-null.
- * @param param2 the second parameter to validate as non-null.
- * @param param3 the third parameter to validate as non-null.
- * @return true always. This allows this call to be used in an assert
- * statement, which can skip this check and remove all
- * overhead from the calling code. This idiom should only be used when
- * performance testing proves that it is necessary.
- *
- * @throws AssertionError if and only if one of the parameters is null
- */
- public static boolean ensureNotNull(Object param1, Object param2,
- Object param3)
- throws AssertionError {
- if (ENABLE_CHECKS) {
- if (param1 == null) throwNull(PARAM_DESCRIPTIONS[1]);
- if (param2 == null) throwNull(PARAM_DESCRIPTIONS[2]);
- if (param3 == null) throwNull(PARAM_DESCRIPTIONS[3]);
- }
- return true;
- }
-
-
-
- /**
- * This method validates that the specified parameters are not null. It
- * throws an AssertionError if one of them are null after logging this error.
- * It's similar to the ensureNotNull(Object) call except it provides the
- * convenience of checking four parameters at once.
- * <p>
- * This should be used like an assert, except it is not turned
- * off at runtime. That is, it should only be used in situations where
- * there is a bug in someone's code if param is null.
- * <p>
- * See the class level javadoc for why we did not use varargs to
- * implement this method.
- *
- * @param param1 the first parameter to validate as non-null.
- * @param param2 the second parameter to validate as non-null.
- * @param param3 the third parameter to validate as non-null.
- * @param param4 the fourth parameter to validate as non-null.
- * @return true always. This allows this call to be used in an assert
- * statement, which can skip this check and remove all
- * overhead from the calling code. This idiom should only be used when
- * performance testing proves that it is necessary.
- *
- * @throws AssertionError if and only if one of the parameters is null
- */
- public static boolean ensureNotNull(Object param1, Object param2,
- Object param3, Object param4)
- throws AssertionError {
- if (ENABLE_CHECKS) {
- if (param1 == null) throwNull(PARAM_DESCRIPTIONS[1]);
- if (param2 == null) throwNull(PARAM_DESCRIPTIONS[2]);
- if (param3 == null) throwNull(PARAM_DESCRIPTIONS[3]);
- if (param4 == null) throwNull(PARAM_DESCRIPTIONS[4]);
- }
- return true;
- }
-
-
- /**
- * This method validates that the specified parameter is true. It
- * throws an AssertionError if it is not true.
- * <p>
- * This should be used like an assert, except it is not turned
- * off at runtime. That is, it should only be used in situations where
- * there is a bug in someone's code if param is null. The other advantage of
- * using this method instead of an assert is that it logs the error to the
- * debug and error logs.
- *
- * @param condition the condition that must be true.
- * @return true always. This allows this call to be used in an assert
- * statement, which can skip this check and remove all
- * overhead from the calling code. This idiom should only be used when
- * performance testing proves that it is necessary.
- *
- * @throws AssertionError if condition is false
- */
- public static boolean ensureTrue(boolean condition)
- throws AssertionError {
- if (ENABLE_CHECKS) {
- if (!condition) {
- ensureTrue(condition, "");
- }
- }
- return true;
- }
-
-
-
- /**
- * This method validates that the specified parameter is true. It
- * throws an AssertionError if it is not true. The supplied message is
- * included in the error message.
- * <p>
- * This should be used like an assert, except it is not turned
- * off at runtime. That is, it should only be used in situations where
- * there is a bug in someone's code if param is null. The other advantage of
- * using this method instead of an assert is that it logs the error to the
- * debug and error logs.
- *
- * @param condition the condition that must be true.
- * @param message the textual message to include in the error message.
- * @return true always. This allows this call to be used in an assert
- * statement, which can skip this check and remove all
- * overhead from the calling code. This idiom should only be used when
- * performance testing proves that it is necessary.
- *
- * @throws AssertionError if condition is false
- */
- public static boolean ensureTrue(boolean condition, String message)
- throws AssertionError {
- if (ENABLE_CHECKS) {
- if (!condition) {
- StringBuilder mb = new StringBuilder();
- mb.append("The specified condition must be true. ");
- mb.append(message);
- String fullString = generateLineSpecificErrorString(mb.toString());
-
- logError(fullString);
-
- throw new AssertionError(fullString);
- }
- }
- return true;
- }
-
- ////////////////////////////////////////////////////////////////////////////
- //
- // ERROR COUNT
- //
- ////////////////////////////////////////////////////////////////////////////
-
-
- /**
- * Returns the number of errors that this class has detected since the
- * system started or the last time that resetErrorCount() was called.
- * <p>
- * This could be useful in the unit tests to validate that no background
- * errors occurred during a test. It could also be exposed by the monitoring
- * framekwork.
- *
- * @return the number of errors detected by this class since the error count
- * was last reset.
- */
- public static synchronized long getErrorCount() {
- return _errorCount;
- }
-
-
- /**
- * Resets the error count to zero.
- */
- public static synchronized void resetErrorCount() {
- _errorCount = 0;
- }
-
-
- private static synchronized void incrementErrorCount() {
- _errorCount++;
- }
-
-
- ////////////////////////////////////////////////////////////////////////////
- //
- // PRIVATE
- //
- ////////////////////////////////////////////////////////////////////////////
-
-
- private static String generateLineSpecificErrorString(String message) {
- StringBuilder mb = new StringBuilder();
- mb.append(message);
- mb.append(" The error occurred at ");
- mb.append(getOriginalCallerLineInfo());
- return mb.toString();
- }
-
-
- private static void throwNull(String message)
- throws AssertionError {
- StringBuilder mb = new StringBuilder();
- mb.append("The specified parameter must not be null. ");
- mb.append(message);
- String fullString = generateLineSpecificErrorString(mb.toString());
-
- logError(fullString);
-
- throw new AssertionError(fullString);
- }
-
-
-
- private static void logError(String message) {
- incrementErrorCount();
-
- StringBuilder mb = new StringBuilder();
- mb.append(message);
- mb.append(ServerConstants.EOL);
- mb.append(getCallingStack());
- String messageWithStack = mb.toString();
-
- // Log to the debug log.
- if (debugEnabled())
- {
- TRACER.debugError(messageWithStack.toString());
- }
-
- // Log to the error log.
- ErrorLogger.logError(Message.raw(messageWithStack));
- }
-
-
- /*
- * @return a String representation of the line that called the
- * Validator method.
- */
- private static String getOriginalCallerLineInfo() {
- StackTraceElement stackElements[] = Thread.currentThread().getStackTrace();
- int callerIndex = getOriginalCallerStackIndex(stackElements);
- return stackElements[callerIndex].toString();
- }
-
-
- /*
- * @return a stack trace rooted at the line that called the first
- * Validator method.
- */
- private static String getCallingStack() {
- StackTraceElement stackElements[] = Thread.currentThread().getStackTrace();
- int callerIndex = getOriginalCallerStackIndex(stackElements);
-
- StringBuilder buffer = new StringBuilder();
- for (int i = callerIndex; i < stackElements.length; i++) {
- StackTraceElement stackElement = stackElements[i];
- buffer.append(stackElement).append(ServerConstants.EOL);
- }
-
- return buffer.toString();
- }
-
-
- /*
- * @return the index in the supplied stack trace of the first non-Validator
- * method.
- */
- private static int getOriginalCallerStackIndex(StackTraceElement stack[]) {
- // Go up the stack until we find who called the first Validator method.
- StackTraceElement element = null;
- int i;
- for (i = 0; i < stack.length; i++) {
- element = stack[i];
- // The stack trace of this thread looks like
- // java.lang.Thread.dumpThreads(Native Method)
- // java.lang.Thread.getStackTrace(Thread.java:1383)
- // org.opends.server.util.Validator.getOriginalCallerLineInfo...
- // ...
- // original caller <---- this is what we want to return
- // more stack
- if (!element.getClassName().equals(Validator.class.getName()) &&
- !element.getClassName().equals(Thread.class.getName())) {
- break;
- }
- }
-
- return i;
- }
-}
diff --git a/opendj3-server-dev/src/server/org/opends/server/workflowelement/localbackend/LocalBackendModifyOperation.java b/opendj3-server-dev/src/server/org/opends/server/workflowelement/localbackend/LocalBackendModifyOperation.java
index 79daf6e..769acdb 100644
--- a/opendj3-server-dev/src/server/org/opends/server/workflowelement/localbackend/LocalBackendModifyOperation.java
+++ b/opendj3-server-dev/src/server/org/opends/server/workflowelement/localbackend/LocalBackendModifyOperation.java
@@ -52,7 +52,7 @@
import org.opends.server.types.operation.PostResponseModifyOperation;
import org.opends.server.types.operation.PostSynchronizationModifyOperation;
import org.opends.server.types.operation.PreOperationModifyOperation;
-import org.opends.server.util.Validator;
+import org.forgerock.util.Reject;
/**
* This class defines an operation used to modify an entry in a local backend
@@ -1503,7 +1503,7 @@
*/
private void validateObjectClasses(Attribute attr) throws DirectoryException
{
- Validator.ensureTrue(attr.getAttributeType().isObjectClassType());
+ Reject.ifFalse(attr.getAttributeType().isObjectClassType());
for (AttributeValue v : attr)
{
String name = v.getValue().toString();
diff --git a/opendj3-server-dev/tests/unit-tests-testng/src/server/org/opends/server/admin/BooleanPropertyDefinitionTest.java b/opendj3-server-dev/tests/unit-tests-testng/src/server/org/opends/server/admin/BooleanPropertyDefinitionTest.java
index 32a72ad..80a04e9 100644
--- a/opendj3-server-dev/tests/unit-tests-testng/src/server/org/opends/server/admin/BooleanPropertyDefinitionTest.java
+++ b/opendj3-server-dev/tests/unit-tests-testng/src/server/org/opends/server/admin/BooleanPropertyDefinitionTest.java
@@ -22,6 +22,7 @@
*
*
* Copyright 2008 Sun Microsystems, Inc.
+ * Portions Copyright 2014 ForgeRock AS
*/
package org.opends.server.admin;
@@ -44,7 +45,7 @@
/**
* Sets up tests.
- *
+ *
* @throws Exception
* If the server could not be initialized.
*/
@@ -70,7 +71,7 @@
/**
* Tests validateValue() with illegal data
*/
- @Test(expectedExceptions = AssertionError.class)
+ @Test(expectedExceptions = NullPointerException.class)
public void testValidateValue2() {
BooleanPropertyDefinition d = createPropertyDefinition();
d.validateValue(null);
@@ -113,7 +114,7 @@
* @param value to decode
*/
@Test(dataProvider = "testDecodeValueData2",
- expectedExceptions = {AssertionError.class,IllegalPropertyValueStringException.class})
+ expectedExceptions = {NullPointerException.class,IllegalPropertyValueStringException.class})
public void testDecodeValue2(String value) {
BooleanPropertyDefinition d = createPropertyDefinition();
d.decodeValue(value);
diff --git a/opendj3-server-dev/tests/unit-tests-testng/src/server/org/opends/server/admin/EnumPropertyDefinitionTest.java b/opendj3-server-dev/tests/unit-tests-testng/src/server/org/opends/server/admin/EnumPropertyDefinitionTest.java
index 6498dc9..d9a00b7 100644
--- a/opendj3-server-dev/tests/unit-tests-testng/src/server/org/opends/server/admin/EnumPropertyDefinitionTest.java
+++ b/opendj3-server-dev/tests/unit-tests-testng/src/server/org/opends/server/admin/EnumPropertyDefinitionTest.java
@@ -22,6 +22,7 @@
*
*
* Copyright 2008 Sun Microsystems, Inc.
+ * Portions Copyright 2014 ForgeRock AS
*/
package org.opends.server.admin;
@@ -116,7 +117,7 @@
* @param value to decode
*/
@Test(dataProvider = "decodeValueData2",
- expectedExceptions = {AssertionError.class,
+ expectedExceptions = {NullPointerException.class,
IllegalPropertyValueStringException.class} )
public void testDecodeValue2(String value) {
EnumPropertyDefinition epd = builder.getInstance();
diff --git a/opendj3-server-dev/tests/unit-tests-testng/src/server/org/opends/server/admin/client/ldap/CreateEntryMockLDAPConnection.java b/opendj3-server-dev/tests/unit-tests-testng/src/server/org/opends/server/admin/client/ldap/CreateEntryMockLDAPConnection.java
index 2d94df6..773b45a 100644
--- a/opendj3-server-dev/tests/unit-tests-testng/src/server/org/opends/server/admin/client/ldap/CreateEntryMockLDAPConnection.java
+++ b/opendj3-server-dev/tests/unit-tests-testng/src/server/org/opends/server/admin/client/ldap/CreateEntryMockLDAPConnection.java
@@ -22,6 +22,7 @@
*
*
* Copyright 2008 Sun Microsystems, Inc.
+ * Portions Copyright 2014 ForgeRock AS
*/
package org.opends.server.admin.client.ldap;
@@ -39,7 +40,7 @@
import javax.naming.directory.Attributes;
import javax.naming.ldap.LdapName;
-import org.opends.server.util.Validator;
+import org.forgerock.util.Reject;
import org.testng.Assert;
@@ -88,9 +89,9 @@
*/
public void addExpectedAttribute(String expectedName,
String... expectedValues) {
- Validator.ensureNotNull(expectedName);
- Validator.ensureNotNull(expectedValues);
- Validator.ensureTrue(expectedValues.length > 0);
+ Reject.ifNull(expectedName);
+ Reject.ifNull(expectedValues);
+ Reject.ifFalse(expectedValues.length > 0);
attributes.put(expectedName, Arrays.asList(expectedValues));
}
diff --git a/opendj3-server-dev/tests/unit-tests-testng/src/server/org/opends/server/admin/client/ldap/ModifyEntryMockLDAPConnection.java b/opendj3-server-dev/tests/unit-tests-testng/src/server/org/opends/server/admin/client/ldap/ModifyEntryMockLDAPConnection.java
index 22754a4..f95d003 100644
--- a/opendj3-server-dev/tests/unit-tests-testng/src/server/org/opends/server/admin/client/ldap/ModifyEntryMockLDAPConnection.java
+++ b/opendj3-server-dev/tests/unit-tests-testng/src/server/org/opends/server/admin/client/ldap/ModifyEntryMockLDAPConnection.java
@@ -22,6 +22,7 @@
*
*
* Copyright 2008 Sun Microsystems, Inc.
+ * Portions Copyright 2014 ForgeRock AS
*/
package org.opends.server.admin.client.ldap;
@@ -39,7 +40,7 @@
import javax.naming.directory.Attributes;
import javax.naming.ldap.LdapName;
-import org.opends.server.util.Validator;
+import org.forgerock.util.Reject;
import org.testng.Assert;
@@ -90,8 +91,8 @@
*/
public void addExpectedModification(String expectedName,
String... expectedValues) {
- Validator.ensureNotNull(expectedName);
- Validator.ensureNotNull(expectedValues);
+ Reject.ifNull(expectedName);
+ Reject.ifNull(expectedValues);
modifications.put(expectedName, Arrays.asList(expectedValues));
}
diff --git a/opendj3-server-dev/tests/unit-tests-testng/src/server/org/opends/server/controls/ProxiedAuthV2ControlTestCase.java b/opendj3-server-dev/tests/unit-tests-testng/src/server/org/opends/server/controls/ProxiedAuthV2ControlTestCase.java
index 22d0c4f..ebf38c4 100644
--- a/opendj3-server-dev/tests/unit-tests-testng/src/server/org/opends/server/controls/ProxiedAuthV2ControlTestCase.java
+++ b/opendj3-server-dev/tests/unit-tests-testng/src/server/org/opends/server/controls/ProxiedAuthV2ControlTestCase.java
@@ -67,7 +67,7 @@
/**
* Tests the constructor with a {@code null} authorization ID.
*/
- @Test(expectedExceptions = { AssertionError.class })
+ @Test(expectedExceptions = { NullPointerException.class })
public void testConstructorNullAuthzID()
{
new ProxiedAuthV2Control(null);
diff --git a/opendj3-server-dev/tests/unit-tests-testng/src/server/org/opends/server/extensions/SimilarityBasedPasswordValidatorTestCase.java b/opendj3-server-dev/tests/unit-tests-testng/src/server/org/opends/server/extensions/SimilarityBasedPasswordValidatorTestCase.java
index d593dfe..73f791e 100644
--- a/opendj3-server-dev/tests/unit-tests-testng/src/server/org/opends/server/extensions/SimilarityBasedPasswordValidatorTestCase.java
+++ b/opendj3-server-dev/tests/unit-tests-testng/src/server/org/opends/server/extensions/SimilarityBasedPasswordValidatorTestCase.java
@@ -55,7 +55,7 @@
/**
- * A set of test cases for the Similarity-Based Password Validator.
+ * A set of test cases for the Similarity-Based Password Reject.
*/
public class SimilarityBasedPasswordValidatorTestCase
extends ExtensionsTestCase
diff --git a/opendj3-server-dev/tests/unit-tests-testng/src/server/org/opends/server/util/LevenshteinDistanceTestCase.java b/opendj3-server-dev/tests/unit-tests-testng/src/server/org/opends/server/util/LevenshteinDistanceTestCase.java
index 2490e12..9babe6f 100644
--- a/opendj3-server-dev/tests/unit-tests-testng/src/server/org/opends/server/util/LevenshteinDistanceTestCase.java
+++ b/opendj3-server-dev/tests/unit-tests-testng/src/server/org/opends/server/util/LevenshteinDistanceTestCase.java
@@ -22,6 +22,7 @@
*
*
* Copyright 2008 Sun Microsystems, Inc.
+ * Portions Copyright 2014 ForgeRock AS
*/
package org.opends.server.util;
@@ -160,7 +161,7 @@
// ===+++======= --> 3
new Object[] { "brad+angelina", "brangelina", 3 },
- // test international chars
+ // test international chars
// ?e?uli?ka
// e?uli?ka
// -======== --> 1
@@ -229,7 +230,7 @@
* @param t The target string to compare.
*/
@Test(dataProvider = "testnulls",
- expectedExceptions = { AssertionError.class })
+ expectedExceptions = { NullPointerException.class })
public void testNullStrings(String s, String t)
{
LevenshteinDistance.calculate(s, t);
diff --git a/opendj3-server-dev/tests/unit-tests-testng/src/server/org/opends/server/util/ValidatorTests.java b/opendj3-server-dev/tests/unit-tests-testng/src/server/org/opends/server/util/ValidatorTests.java
deleted file mode 100644
index 468e085..0000000
--- a/opendj3-server-dev/tests/unit-tests-testng/src/server/org/opends/server/util/ValidatorTests.java
+++ /dev/null
@@ -1,168 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
- *
- * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
- * or http://forgerock.org/license/CDDLv1.0.html.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at legal-notices/CDDLv1_0.txt.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information:
- * Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- *
- *
- * Copyright 2006-2008 Sun Microsystems, Inc.
- * Portions copyright 2011 ForgeRock AS
- */
-package org.opends.server.util;
-
-import org.testng.annotations.Test;
-import org.testng.annotations.DataProvider;
-import static org.testng.Assert.*;
-import org.opends.server.DirectoryServerTestCase;
-
-/**
- * Tests for the Validator class.
- */
-public class ValidatorTests extends DirectoryServerTestCase {
- private static final Object NON_NULL = new Object();
-
- //////////////////////////////////////////////////////////////////////////////
- //
- // POSITIVE TESTS
- //
- //////////////////////////////////////////////////////////////////////////////
-
- @Test
- public void testEnsureNotNull() {
- boolean returnValue = Validator.ensureNotNull(NON_NULL);
- assertTrue(returnValue); // must always return true
- }
-
- @Test
- public void testEnsureNotNull2() {
- boolean returnValue = Validator.ensureNotNull(NON_NULL, NON_NULL);
- assertTrue(returnValue); // must always return true
- }
-
- @Test
- public void testEnsureNotNull3() {
- boolean returnValue = Validator.ensureNotNull(NON_NULL, NON_NULL, NON_NULL);
- assertTrue(returnValue); // must always return true
- }
-
- @Test
- public void testEnsureNotNull4() {
- boolean returnValue = Validator.ensureNotNull(NON_NULL, NON_NULL, NON_NULL, NON_NULL);
- assertTrue(returnValue); // must always return true
- }
-
- @Test
- public void testEnsureTrue() {
- boolean returnValue = Validator.ensureTrue(true);
- assertTrue(returnValue); // must always return true
- }
-
- @Test
- public void testEnsureTrueWithMessage() {
- boolean returnValue = Validator.ensureTrue(true, "some message");
- assertTrue(returnValue); // must always return true
- }
-
- //////////////////////////////////////////////////////////////////////////////
- //
- // NEGATIVE TESTS
- //
- //////////////////////////////////////////////////////////////////////////////
-
- @Test(expectedExceptions = {NullPointerException.class, AssertionError.class})
- public void testEnsureNotNullWithNull() {
- Validator.ensureNotNull(null); // Should throw
- }
-
-
- @Test(expectedExceptions = {NullPointerException.class, AssertionError.class},
- dataProvider = "dataEnsureNotNull2WithNull")
- public void testEnsureNotNull2WithNull(Object param1, Object param2) {
- Validator.ensureNotNull(param1, param2); // Should throw
- }
-
- @DataProvider(name = "dataEnsureNotNull2WithNull")
- public Object[][] dataEnsureNotNull2WithNull() {
- return new Object[][]{
- {null, NON_NULL},
- {NON_NULL, null}};
- }
-
-
- @Test(expectedExceptions = {NullPointerException.class, AssertionError.class},
- dataProvider = "dataEnsureNotNull3WithNull")
- public void testEnsureNotNull3WithNull(Object param1, Object param2, Object param3) {
- Validator.ensureNotNull(param1, param2, param3); // Should throw
- }
-
- @DataProvider(name = "dataEnsureNotNull3WithNull")
- public Object[][] dataEnsureNotNull3WithNull() {
- return new Object[][]{
- {null, NON_NULL, NON_NULL},
- {NON_NULL, null, NON_NULL},
- {NON_NULL, NON_NULL, null}};
- }
-
-
- @Test(expectedExceptions = {NullPointerException.class, AssertionError.class},
- dataProvider = "dataEnsureNotNull4WithNull")
- public void testEnsureNotNull4WithNull(Object param1, Object param2, Object param3, Object param4) {
- Validator.ensureNotNull(param1, param2, param3, param4); // Should throw
- }
-
- @DataProvider(name = "dataEnsureNotNull4WithNull")
- public Object[][] dataEnsureNotNull4WithNull() {
- return new Object[][]{
- {null, NON_NULL, NON_NULL, NON_NULL},
- {NON_NULL, null, NON_NULL, NON_NULL},
- {NON_NULL, NON_NULL, null, NON_NULL},
- {NON_NULL, NON_NULL, NON_NULL, null}};
- }
-
-
- @Test(expectedExceptions = {RuntimeException.class, AssertionError.class})
- public void testEnsureTrueWithFalse() {
- Validator.ensureTrue(false);
- }
-
-
- @Test(expectedExceptions = {RuntimeException.class, AssertionError.class})
- public void testEnsureTrueWithMessageWithFalse() {
- Validator.ensureTrue(false, "some message");
- }
-
-
- @Test
- public void testMessageContents() {
- Validator.resetErrorCount();
- String myMessage = "some test message";
- String thisMethod = ValidatorTests.class.getName() + "." + "testMessageContents(ValidatorTests.java:";
- try {
- Validator.ensureTrue(false, myMessage);
- } catch (Throwable e) {
- String caughtMessage = e.getMessage();
- assertTrue(caughtMessage.indexOf(myMessage) >= 0);
- assertTrue(caughtMessage.indexOf(thisMethod) >= 0);
-
- assertEquals(Validator.getErrorCount(), 1);
- Validator.resetErrorCount();
- assertEquals(Validator.getErrorCount(), 0);
- }
- }
-}
--
Gitblit v1.10.0