From a41662c1136b2bb4a4198df89e0e87d2be3ef099 Mon Sep 17 00:00:00 2001
From: Jean-Noel Rouvignac <jean-noel.rouvignac@forgerock.com>
Date: Thu, 16 Jul 2015 14:57:56 +0000
Subject: [PATCH] AutoRefactor'ed simplify expressions
---
opendj-server-legacy/src/main/java/org/opends/server/config/MultiChoiceConfigAttribute.java | 46 +++++++++++++++++-----------------------------
1 files changed, 17 insertions(+), 29 deletions(-)
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/config/MultiChoiceConfigAttribute.java b/opendj-server-legacy/src/main/java/org/opends/server/config/MultiChoiceConfigAttribute.java
index 794196f..e703cb2 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/config/MultiChoiceConfigAttribute.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/config/MultiChoiceConfigAttribute.java
@@ -288,19 +288,15 @@
* @throws ConfigException If this attribute does not have exactly one
* active value.
*/
- public String activeValue()
- throws ConfigException
+ public String activeValue() throws ConfigException
{
- if ((activeValues == null) || activeValues.isEmpty())
+ if (activeValues == null || activeValues.isEmpty())
{
- LocalizableMessage message = ERR_CONFIG_ATTR_NO_STRING_VALUE.get(getName());
- throw new ConfigException(message);
+ throw new ConfigException(ERR_CONFIG_ATTR_NO_STRING_VALUE.get(getName()));
}
-
if (activeValues.size() > 1)
{
- LocalizableMessage message = ERR_CONFIG_ATTR_MULTIPLE_STRING_VALUES.get(getName());
- throw new ConfigException(message);
+ throw new ConfigException(ERR_CONFIG_ATTR_MULTIPLE_STRING_VALUES.get(getName()));
}
return activeValues.get(0);
@@ -339,16 +335,13 @@
return activeValue();
}
- if ((pendingValues == null) || pendingValues.isEmpty())
+ if (pendingValues == null || pendingValues.isEmpty())
{
- LocalizableMessage message = ERR_CONFIG_ATTR_NO_STRING_VALUE.get(getName());
- throw new ConfigException(message);
+ throw new ConfigException(ERR_CONFIG_ATTR_NO_STRING_VALUE.get(getName()));
}
-
if (pendingValues.size() > 1)
{
- LocalizableMessage message = ERR_CONFIG_ATTR_MULTIPLE_STRING_VALUES.get(getName());
- throw new ConfigException(message);
+ throw new ConfigException(ERR_CONFIG_ATTR_MULTIPLE_STRING_VALUES.get(getName()));
}
return pendingValues.get(0);
@@ -399,7 +392,7 @@
public void setValue(String value)
throws ConfigException
{
- if ((value == null) || (value.length() == 0))
+ if (value == null || value.length() == 0)
{
LocalizableMessage message = ERR_CONFIG_ATTR_EMPTY_STRING_VALUE.get(getName());
throw new ConfigException(message);
@@ -461,7 +454,7 @@
// Next check if the set contains multiple values and if that is allowed.
int numValues = values.size();
- if ((! isMultiValued()) && (numValues > 1))
+ if (!isMultiValued() && numValues > 1)
{
throw new ConfigException(ERR_CONFIG_ATTR_SET_VALUES_IS_SINGLE_VALUED.get(getName()));
}
@@ -540,7 +533,7 @@
{
// Make sure that the value is non-empty.
String stringValue;
- if (value == null || ((stringValue = value.toString()).length() == 0))
+ if (value == null || (stringValue = value.toString()).length() == 0)
{
rejectReason.append(ERR_CONFIG_ATTR_EMPTY_STRING_VALUE.get(getName()));
return false;
@@ -550,8 +543,7 @@
// Make sure that the value is in the allowed value set.
if (! allowedValues.contains(stringValue.toLowerCase()))
{
- rejectReason.append(ERR_CONFIG_ATTR_VALUE_NOT_ALLOWED.get(
- stringValue, getName()));
+ rejectReason.append(ERR_CONFIG_ATTR_VALUE_NOT_ALLOWED.get(stringValue, getName()));
return false;
}
@@ -731,7 +723,7 @@
else
{
int numValues = a.size();
- if ((numValues > 1) && (! isMultiValued()))
+ if (numValues > 1 && !isMultiValued())
{
// This is illegal -- the attribute is single-valued.
LocalizableMessage message =
@@ -746,8 +738,7 @@
if (! allowedValues.contains(lowerValue))
{
// This is illegal -- the value is not allowed.
- throw new ConfigException(ERR_CONFIG_ATTR_VALUE_NOT_ALLOWED.get(
- v, a.getName()));
+ throw new ConfigException(ERR_CONFIG_ATTR_VALUE_NOT_ALLOWED.get(v, a.getName()));
}
pendingValues.add(v.toString());
@@ -789,7 +780,7 @@
else
{
int numValues = a.size();
- if ((numValues > 1) && (! isMultiValued()))
+ if (numValues > 1 && ! isMultiValued())
{
// This is illegal -- the attribute is single-valued.
LocalizableMessage message =
@@ -804,8 +795,7 @@
if (! allowedValues.contains(lowerValue))
{
// This is illegal -- the value is not allowed.
- throw new ConfigException(ERR_CONFIG_ATTR_VALUE_NOT_ALLOWED.get(
- v, a.getName()));
+ throw new ConfigException(ERR_CONFIG_ATTR_VALUE_NOT_ALLOWED.get(v, a.getName()));
}
activeValues.add(v.toString());
@@ -943,8 +933,7 @@
}
- if (requiresAdminAction() && (pendingValues != null) &&
- (pendingValues != activeValues))
+ if (requiresAdminAction() && pendingValues != null && pendingValues != activeValues)
{
String name = getName() + ";" + OPTION_PENDING_VALUES;
@@ -957,8 +946,7 @@
}
else if (! pendingValues.isEmpty())
{
- attributeList.add(new javax.management.Attribute(name,
- pendingValues.get(0)));
+ attributeList.add(new javax.management.Attribute(name, pendingValues.get(0)));
}
}
}
--
Gitblit v1.10.0