From 4ed3b08887c800fb6f02ecc90df9092691b78208 Mon Sep 17 00:00:00 2001
From: Jean-Noël Rouvignac <jean-noel.rouvignac@forgerock.com>
Date: Wed, 30 Mar 2016 08:51:11 +0000
Subject: [PATCH] Prep work for OPENDJ-2803 Migrate Attribute
---
opendj-server-legacy/src/main/java/org/opends/server/config/IntegerWithUnitConfigAttribute.java | 22 ++++++++++------------
1 files changed, 10 insertions(+), 12 deletions(-)
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/config/IntegerWithUnitConfigAttribute.java b/opendj-server-legacy/src/main/java/org/opends/server/config/IntegerWithUnitConfigAttribute.java
index 545022d..2b09373 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/config/IntegerWithUnitConfigAttribute.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/config/IntegerWithUnitConfigAttribute.java
@@ -874,12 +874,12 @@
if (!attrDesc.hasOption(OPTION_PENDING_VALUES))
{
// This is illegal -- only the pending option is allowed for configuration attributes.
- throw new ConfigException(ERR_CONFIG_ATTR_OPTIONS_NOT_ALLOWED.get(attrDesc.getNameOrOID()));
+ throw new ConfigException(ERR_CONFIG_ATTR_OPTIONS_NOT_ALLOWED.get(attrDesc));
}
if (pendingUnit != null)
{
// We cannot have multiple pending value sets.
- throw new ConfigException(ERR_CONFIG_ATTR_MULTIPLE_PENDING_VALUE_SETS.get(attrDesc.getNameOrOID()));
+ throw new ConfigException(ERR_CONFIG_ATTR_MULTIPLE_PENDING_VALUE_SETS.get(attrDesc));
}
String valueString = getValue(a);
@@ -891,8 +891,7 @@
}
catch (Exception e)
{
- throw new ConfigException(ERR_CONFIG_ATTR_COULD_NOT_PARSE_INT_COMPONENT.get(
- valueString, attrDesc.getNameOrOID(), e));
+ throw new ConfigException(ERR_CONFIG_ATTR_COULD_NOT_PARSE_INT_COMPONENT.get(valueString, attrDesc, e));
}
pendingCalculatedValue = calculateValue(pendingIntValue, activeUnit, pendingUnit, a);
@@ -903,7 +902,7 @@
if (activeUnit != null)
{
// We cannot have multiple active value sets.
- throw new ConfigException(ERR_CONFIG_ATTR_MULTIPLE_ACTIVE_VALUE_SETS.get(attrDesc.getNameOrOID()));
+ throw new ConfigException(ERR_CONFIG_ATTR_MULTIPLE_ACTIVE_VALUE_SETS.get(attrDesc));
}
String valueString = getValue(a);
@@ -915,8 +914,7 @@
}
catch (Exception e)
{
- throw new ConfigException(ERR_CONFIG_ATTR_COULD_NOT_PARSE_INT_COMPONENT.get(
- valueString, attrDesc.getNameOrOID(), e));
+ throw new ConfigException(ERR_CONFIG_ATTR_COULD_NOT_PARSE_INT_COMPONENT.get(valueString, attrDesc, e));
}
activeCalculatedValue = calculateValue(activeIntValue, activeUnit, activeUnit, a);
@@ -951,7 +949,7 @@
if (a.isEmpty())
{
// This is illegal -- it must have a value.
- throw new ConfigException(ERR_CONFIG_ATTR_IS_REQUIRED.get(attrDesc.getNameOrOID()));
+ throw new ConfigException(ERR_CONFIG_ATTR_IS_REQUIRED.get(attrDesc));
}
Iterator<ByteString> iterator = a.iterator();
@@ -959,7 +957,7 @@
if (iterator.hasNext())
{
// This is illegal -- the attribute is single-valued.
- throw new ConfigException(ERR_CONFIG_ATTR_SET_VALUES_IS_SINGLE_VALUED.get(attrDesc.getNameOrOID()));
+ throw new ConfigException(ERR_CONFIG_ATTR_SET_VALUES_IS_SINGLE_VALUED.get(attrDesc));
}
return valueString;
}
@@ -970,7 +968,7 @@
AttributeDescription attrDesc = a.getAttributeDescription();
if (!units.containsKey(pendingUnit))
{
- throw new ConfigException(ERR_CONFIG_ATTR_INVALID_UNIT.get(pendingUnit, attrDesc.getNameOrOID()));
+ throw new ConfigException(ERR_CONFIG_ATTR_INVALID_UNIT.get(pendingUnit, attrDesc));
}
double multiplier = units.get(activeUnit);
@@ -979,11 +977,11 @@
// Check the bounds set for this attribute.
if (hasLowerBound && result < lowerBound)
{
- throw new ConfigException(ERR_CONFIG_ATTR_INT_BELOW_LOWER_BOUND.get(attrDesc.getNameOrOID(), result, lowerBound));
+ throw new ConfigException(ERR_CONFIG_ATTR_INT_BELOW_LOWER_BOUND.get(attrDesc, result, lowerBound));
}
if (hasUpperBound && result > upperBound)
{
- throw new ConfigException(ERR_CONFIG_ATTR_INT_ABOVE_UPPER_BOUND.get(attrDesc.getNameOrOID(), result, upperBound));
+ throw new ConfigException(ERR_CONFIG_ATTR_INT_ABOVE_UPPER_BOUND.get(attrDesc, result, upperBound));
}
return result;
}
--
Gitblit v1.10.0