From ca669ae54f86dbeea277280690584d9f591c7571 Mon Sep 17 00:00:00 2001
From: Jean-Noel Rouvignac <jean-noel.rouvignac@forgerock.com>
Date: Wed, 18 Feb 2015 07:26:26 +0000
Subject: [PATCH] AutoRefactor: collapse if statements

---
 opendj-server-legacy/src/main/java/org/opends/server/admin/DurationPropertyDefinition.java |   38 ++++++++++++--------------------------
 1 files changed, 12 insertions(+), 26 deletions(-)

diff --git a/opendj-server-legacy/src/main/java/org/opends/server/admin/DurationPropertyDefinition.java b/opendj-server-legacy/src/main/java/org/opends/server/admin/DurationPropertyDefinition.java
index e81e2c6..ea7f530 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/admin/DurationPropertyDefinition.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/admin/DurationPropertyDefinition.java
@@ -155,13 +155,9 @@
         throws IllegalArgumentException {
       ifNull(unit);
 
-      // Make sure that the base unit is not bigger than the maximum
-      // unit.
-      if (maximumUnit != null) {
-        if (unit.getDuration() > maximumUnit.getDuration()) {
-          throw new IllegalArgumentException(
-              "Base unit greater than maximum unit");
-        }
+      // Make sure that the base unit is not bigger than the maximum unit.
+      if (maximumUnit != null && unit.getDuration() > maximumUnit.getDuration()) {
+        throw new IllegalArgumentException("Base unit greater than maximum unit");
       }
 
       this.baseUnit = unit;
@@ -201,18 +197,13 @@
      *          The maximum unit, or <code>null</code> if there
      *          should not be a maximum unit.
      * @throws IllegalArgumentException
-     *           If the provided maximum unit is smaller than the base
-     *           unit.
+     *           If the provided maximum unit is smaller than the base unit.
      */
     public final void setMaximumUnit(DurationUnit unit)
         throws IllegalArgumentException {
-      if (unit != null) {
-        // Make sure that the maximum unit is not smaller than the
-        // base unit.
-        if (unit.getDuration() < baseUnit.getDuration()) {
-          throw new IllegalArgumentException(
-              "Maximum unit smaller than base unit");
-        }
+      // Make sure that the maximum unit is not smaller than the base unit.
+      if (unit != null && unit.getDuration() < baseUnit.getDuration()) {
+        throw new IllegalArgumentException("Maximum unit smaller than base unit");
       }
 
       this.maximumUnit = unit;
@@ -485,12 +476,9 @@
   public String encodeValue(Long value) throws PropertyException {
     ifNull(value);
 
-    // Make sure that we correctly encode negative values as
-    // "unlimited".
-    if (allowUnlimited) {
-      if (value < 0) {
-        return UNLIMITED;
-      }
+    // Make sure that we correctly encode negative values as "unlimited".
+    if (allowUnlimited && value < 0) {
+      return UNLIMITED;
     }
 
     // Encode the size value using the base unit.
@@ -508,10 +496,8 @@
     ifNull(value);
 
     // First check for the special "unlimited" value when necessary.
-    if (allowUnlimited) {
-      if (value.trim().equalsIgnoreCase(UNLIMITED)) {
-        return -1L;
-      }
+    if (allowUnlimited && value.trim().equalsIgnoreCase(UNLIMITED)) {
+      return -1L;
     }
 
     // Parse the string representation.

--
Gitblit v1.10.0