mirror of https://github.com/OpenIdentityPlatform/OpenDJ.git

Jean-Noel Rouvignac
25.16.2015 f983fc4bc7a4dc0e9d175e77cfaf8a2127aaeb2d
AutoRefactor: fix boolean usage
17 files modified
266 ■■■■ changed files
opendj-core/src/main/java/org/forgerock/opendj/ldap/AbstractMapEntry.java 13 ●●●●● patch | view | raw | blame | history
opendj-core/src/main/java/org/forgerock/opendj/ldap/AttributeDescription.java 23 ●●●● patch | view | raw | blame | history
opendj-maven-plugin/src/main/java/org/forgerock/opendj/maven/GenerateConfigMojo.java 7 ●●●● patch | view | raw | blame | history
opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/ConnectionHandlerMonitoringPanel.java 11 ●●●● patch | view | raw | blame | history
opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/TableViewEntryPanel.java 19 ●●●● patch | view | raw | blame | history
opendj-server-legacy/src/main/java/org/opends/server/api/ClientConnection.java 12 ●●●● patch | view | raw | blame | history
opendj-server-legacy/src/main/java/org/opends/server/authorization/dseecompat/Aci.java 22 ●●●● patch | view | raw | blame | history
opendj-server-legacy/src/main/java/org/opends/server/core/ConnectionHandlerConfigManager.java 18 ●●●● patch | view | raw | blame | history
opendj-server-legacy/src/main/java/org/opends/server/core/ExtendedOperationConfigManager.java 9 ●●●● patch | view | raw | blame | history
opendj-server-legacy/src/main/java/org/opends/server/core/SynchronizationProviderConfigManager.java 22 ●●●● patch | view | raw | blame | history
opendj-server-legacy/src/main/java/org/opends/server/extensions/DynamicGroup.java 9 ●●●● patch | view | raw | blame | history
opendj-server-legacy/src/main/java/org/opends/server/loggers/AbstractTextAccessLogPublisher.java 20 ●●●● patch | view | raw | blame | history
opendj-server-legacy/src/main/java/org/opends/server/loggers/TextAuditLogPublisher.java 10 ●●●● patch | view | raw | blame | history
opendj-server-legacy/src/main/java/org/opends/server/plugins/SambaPasswordPlugin.java 10 ●●●● patch | view | raw | blame | history
opendj-server-legacy/src/main/java/org/opends/server/schema/UserPasswordSyntax.java 21 ●●●● patch | view | raw | blame | history
opendj-server-legacy/src/main/java/org/opends/server/types/SubtreeSpecification.java 31 ●●●● patch | view | raw | blame | history
opendj-server/src/main/java/org/forgerock/opendj/server/core/DataProviderID.java 9 ●●●●● patch | view | raw | blame | history
opendj-core/src/main/java/org/forgerock/opendj/ldap/AbstractMapEntry.java
@@ -22,9 +22,8 @@
 *
 *
 *      Copyright 2009-2010 Sun Microsystems, Inc.
 *      Portions copyright 2012 ForgeRock AS.
 *      Portions copyright 2012-2015 ForgeRock AS.
 */
package org.forgerock.opendj.ldap;
import java.util.Collection;
@@ -110,14 +109,10 @@
            final Collection<? super ByteString> missingValues) {
        final AttributeDescription attributeDescription = attribute.getAttributeDescription();
        if (attribute.isEmpty()) {
            if (attributes.remove(attributeDescription) != null) {
                return true;
            } else if (attributeDescription.isPlaceHolder()) {
            return attributes.remove(attributeDescription) != null
                || (attributeDescription.isPlaceHolder()
                // Fall-back to inefficient remove using place-holder.
                return super.removeAttribute(attribute, missingValues);
            } else {
                return false;
            }
                    && super.removeAttribute(attribute, missingValues));
        } else {
            final Attribute oldAttribute = getAttribute(attributeDescription);
            if (oldAttribute != null) {
opendj-core/src/main/java/org/forgerock/opendj/ldap/AttributeDescription.java
@@ -22,9 +22,8 @@
 *
 *
 *      Copyright 2009-2010 Sun Microsystems, Inc.
 *      Portions copyright 2011-2012 ForgeRock AS
 *      Portions copyright 2011-2015 ForgeRock AS
 */
package org.forgerock.opendj.ldap;
import java.util.Arrays;
@@ -264,11 +263,7 @@
        @Override
        public boolean isSubTypeOf(final Impl other) {
            // Other must have no options or the same option.
            if (other == ZERO_OPTION_IMPL) {
                return true;
            } else {
                return equals(other);
            }
            return other == ZERO_OPTION_IMPL || equals(other);
        }
        @Override
@@ -1159,11 +1154,8 @@
     *             If {@code name} was {@code null}.
     */
    public boolean isSubTypeOf(final AttributeDescription other) {
        if (!attributeType.isSubTypeOf(other.attributeType)) {
            return false;
        } else {
            return pimpl.isSubTypeOf(other.pimpl);
        }
        return attributeType.isSubTypeOf(other.attributeType)
            && pimpl.isSubTypeOf(other.pimpl);
    }
    /**
@@ -1189,11 +1181,8 @@
     *             If {@code name} was {@code null}.
     */
    public boolean isSuperTypeOf(final AttributeDescription other) {
        if (!attributeType.isSuperTypeOf(other.attributeType)) {
            return false;
        } else {
            return pimpl.isSuperTypeOf(other.pimpl);
        }
        return attributeType.isSuperTypeOf(other.attributeType)
            && pimpl.isSuperTypeOf(other.pimpl);
    }
    /**
opendj-maven-plugin/src/main/java/org/forgerock/opendj/maven/GenerateConfigMojo.java
@@ -397,12 +397,9 @@
    }
    private boolean isXMLPackageDirectoryValid() {
        if (isExtension) {
            return new File(getXMLPackageDirectory()).isDirectory();
        } else {
            // Not an extension, so always valid.
            return true;
        }
        return !isExtension
            || new File(getXMLPackageDirectory()).isDirectory();
    }
    private Templates loadStylesheet(final String stylesheet)
opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/ConnectionHandlerMonitoringPanel.java
@@ -590,12 +590,11 @@
  private boolean protocolHasMonitoring(ConnectionHandlerDescriptor ch)
  {
    if (ch.getState() == State.DISABLED)
      return false;
    return ch.getProtocol() == Protocol.LDAP ||
      ch.getProtocol() == Protocol.LDAPS ||
      ch.getProtocol() == Protocol.LDAP_STARTTLS ||
      ch.getProtocol() == Protocol.OTHER;
    return ch.getState() != State.DISABLED
        && (ch.getProtocol() == Protocol.LDAP
            || ch.getProtocol() == Protocol.LDAPS
            || ch.getProtocol() == Protocol.LDAP_STARTTLS
            || ch.getProtocol() == Protocol.OTHER);
  }
  /**
opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/TableViewEntryPanel.java
@@ -644,22 +644,9 @@
     * {@inheritDoc}
     */
    public boolean isCellEditable(int row, int col) {
      if (col == 0)
      {
        return false;
      }
      else
      {
        if (!isReadOnly)
        {
          return !schemaReadOnlyAttributesLowerCase.contains(
              dataArray.get(row).attrName.toLowerCase());
        }
        else
        {
          return false;
        }
      }
      return col != 0
          && !isReadOnly
          && !schemaReadOnlyAttributesLowerCase.contains(dataArray.get(row).attrName.toLowerCase());
    }
    /**
opendj-server-legacy/src/main/java/org/opends/server/api/ClientConnection.java
@@ -22,7 +22,7 @@
 *
 *
 *      Copyright 2006-2009 Sun Microsystems, Inc.
 *      Portions Copyright 2011-2014 ForgeRock AS
 *      Portions Copyright 2011-2015 ForgeRock AS
 */
package org.opends.server.api;
@@ -599,14 +599,8 @@
   */
  public final boolean mustChangePassword()
  {
    if (authenticationInfo == null)
    {
      return false;
    }
    else
    {
      return authenticationInfo.mustChangePassword();
    }
    return authenticationInfo != null
        && authenticationInfo.mustChangePassword();
  }
opendj-server-legacy/src/main/java/org/opends/server/authorization/dseecompat/Aci.java
@@ -451,8 +451,7 @@
     * needed to match ACI targets.
     * @return  True if this ACI targets are applicable or match.
     */
    public static boolean
    isApplicable(Aci aci, AciTargetMatchContext matchCtx) {
    public static boolean isApplicable(Aci aci, AciTargetMatchContext matchCtx) {
      if(matchCtx.hasRights(ACI_EXT_OP)) {
        //Extended operation is being evaluated.
         return AciTargets.isTargetApplicable(aci, matchCtx) &&
@@ -465,16 +464,19 @@
        //If an ACI has extOp or targetControl targets skip it because the
        //matchCtx right does not contain either ACI_EXT_OP or ACI_CONTROL at
        //this point.
        if(aci.getTargets().getExtOp() != null
                || aci.getTargets().getTargetControl() != null) {
           return false;
        return hasNoExtOpOrTargetControl(aci.getTargets())
            && haveSimilarRights(aci, matchCtx)
            && AciTargets.isTargetApplicable(aci, matchCtx)
            && AciTargets.isTargetFilterApplicable(aci, matchCtx)
            && AciTargets.isTargAttrFiltersApplicable(aci, matchCtx)
            && AciTargets.isTargetAttrApplicable(aci, matchCtx);
        }
        return  haveSimilarRights(aci, matchCtx) &&
                AciTargets.isTargetApplicable(aci, matchCtx) &&
                AciTargets.isTargetFilterApplicable(aci, matchCtx) &&
                AciTargets.isTargAttrFiltersApplicable(aci, matchCtx) &&
                AciTargets.isTargetAttrApplicable(aci, matchCtx);
      }
    private static boolean hasNoExtOpOrTargetControl(AciTargets aciTargets)
    {
      return aciTargets.getExtOp() == null
          && aciTargets.getTargetControl() == null;
    }
    private static boolean haveSimilarRights(Aci aci,
opendj-server-legacy/src/main/java/org/opends/server/core/ConnectionHandlerConfigManager.java
@@ -320,13 +320,8 @@
  public boolean isConfigurationAddAcceptable(
      ConnectionHandlerCfg configuration,
      List<LocalizableMessage> unacceptableReasons) {
    if (configuration.isEnabled()) {
      // It's enabled so always validate the class.
      return isJavaClassAcceptable(configuration, unacceptableReasons);
    } else {
      // It's disabled so ignore it.
      return true;
    }
    return !configuration.isEnabled()
        || isJavaClassAcceptable(configuration, unacceptableReasons);
  }
@@ -338,13 +333,8 @@
  public boolean isConfigurationChangeAcceptable(
      ConnectionHandlerCfg configuration,
      List<LocalizableMessage> unacceptableReasons) {
    if (configuration.isEnabled()) {
      // It's enabled so always validate the class.
      return isJavaClassAcceptable(configuration, unacceptableReasons);
    } else {
      // It's disabled so ignore it.
      return true;
    }
    return !configuration.isEnabled()
        || isJavaClassAcceptable(configuration, unacceptableReasons);
  }
opendj-server-legacy/src/main/java/org/opends/server/core/ExtendedOperationConfigManager.java
@@ -157,13 +157,8 @@
       ExtendedOperationHandlerCfg configuration,
       List<LocalizableMessage> unacceptableReasons)
  {
    if (configuration.isEnabled()) {
      // It's enabled so always validate the class.
      return isJavaClassAcceptable(configuration, unacceptableReasons);
    } else {
      // It's disabled so ignore it.
      return true;
    }
    return !configuration.isEnabled()
        || isJavaClassAcceptable(configuration, unacceptableReasons);
  }
  /**
opendj-server-legacy/src/main/java/org/opends/server/core/SynchronizationProviderConfigManager.java
@@ -234,15 +234,8 @@
      SynchronizationProviderCfg configuration,
      List<LocalizableMessage> unacceptableReasons)
  {
    if (configuration.isEnabled())
    {
      // It's enabled so always validate the class.
      return isJavaClassAcceptable(configuration, unacceptableReasons);
    } else
    {
      // It's disabled so ignore it.
      return true;
    }
    return !configuration.isEnabled()
        || isJavaClassAcceptable(configuration, unacceptableReasons);
  }
@@ -309,15 +302,8 @@
      SynchronizationProviderCfg configuration,
      List<LocalizableMessage> unacceptableReasons)
  {
    if (configuration.isEnabled())
    {
      // It's enabled so always validate the class.
      return isJavaClassAcceptable(configuration, unacceptableReasons);
    } else
    {
      // It's disabled so ignore it.
      return true;
    }
    return !configuration.isEnabled()
        || isJavaClassAcceptable(configuration, unacceptableReasons);
  }
opendj-server-legacy/src/main/java/org/opends/server/extensions/DynamicGroup.java
@@ -302,14 +302,7 @@
    }
    Entry entry = DirectoryConfig.getEntry(userDN);
    if (entry == null)
    {
      return false;
    }
    else
    {
      return isMember(entry);
    }
    return entry != null && isMember(entry);
  }
opendj-server-legacy/src/main/java/org/opends/server/loggers/AbstractTextAccessLogPublisher.java
@@ -343,16 +343,9 @@
    private boolean filterRequest(final Operation operation)
    {
      // Check target DN.
      if ((targetDNNotEqualTo.length > 0 || targetDNEqualTo.length > 0)
          && !filterRequestTargetDN(operation))
      {
        return false;
      }
      return (targetDNNotEqualTo.length == 0 && targetDNEqualTo.length == 0)
          || filterRequestTargetDN(operation);
      // TODO: check required controls.
      return true;
    }
@@ -557,13 +550,8 @@
      }
      // Check group membership.
      if ((userIsNotMemberOf.length > 0 || userIsMemberOf.length > 0)
          && !filterUserIsMemberOf(connection))
      {
        return false;
      }
      return true;
      return (userIsNotMemberOf.length == 0 && userIsMemberOf.length == 0)
          || filterUserIsMemberOf(connection);
    }
opendj-server-legacy/src/main/java/org/opends/server/loggers/TextAuditLogPublisher.java
@@ -546,13 +546,7 @@
  // Determines whether the provided operation should be logged.
  private boolean isLoggable(Operation operation)
  {
    if (operation.getResultCode() != SUCCESS)
    {
      return false;
    }
    else
    {
      return isResponseLoggable(operation);
    }
    return operation.getResultCode() == SUCCESS
        && isResponseLoggable(operation);
  }
}
opendj-server-legacy/src/main/java/org/opends/server/plugins/SambaPasswordPlugin.java
@@ -1012,15 +1012,7 @@
    final Schema schema = DirectoryServer.getSchema();
    final ObjectClass sambaOc = schema
        .getObjectClass(toLowerCase(SAMBA_SAM_ACCOUNT_OC_NAME));
    if (sambaOc == null)
    {
      // If the object class is not defined then presumably we're not syncing.
      return false;
    }
    else
    {
      return entry.hasObjectClass(sambaOc);
    }
    return sambaOc != null && entry.hasObjectClass(sambaOc);
  }
opendj-server-legacy/src/main/java/org/opends/server/schema/UserPasswordSyntax.java
@@ -22,7 +22,7 @@
 *
 *
 *      Copyright 2006-2008 Sun Microsystems, Inc.
 *      Portions Copyright 2012-2014 ForgeRock AS
 *      Portions Copyright 2012-2015 ForgeRock AS
 */
package org.opends.server.schema;
import org.forgerock.i18n.LocalizableMessage;
@@ -294,7 +294,7 @@
  public static boolean isEncoded(ByteSequence value)
  {
    // If the value is null or empty, then it's not.
    if ((value == null) || value.length() == 0)
    if (value == null || value.length() == 0)
    {
      return false;
    }
@@ -319,21 +319,10 @@
      }
    }
    if ((closingBracePos < 0) || (closingBracePos == 1))
    {
      return false;
    }
    return closingBracePos >= 0
        && closingBracePos != 1
    // The closing curly brace must not be the last character of the password.
    if (closingBracePos == (value.length() - 1))
    {
      return false;
    }
    // If we've gotten here, then it looks to be encoded.
    return true;
        && closingBracePos != value.length() - 1;
  }
opendj-server-legacy/src/main/java/org/opends/server/types/SubtreeSpecification.java
@@ -335,17 +335,8 @@
    @Override
    public boolean matches(final Entry entry)
    {
      final ObjectClass oc = DirectoryServer
          .getObjectClass(normalizedObjectClass);
      if (oc == null)
      {
        return false;
      }
      else
      {
        return entry.hasObjectClass(oc);
      }
      final ObjectClass oc = DirectoryServer.getObjectClass(normalizedObjectClass);
      return oc != null && entry.hasObjectClass(oc);
    }
@@ -1597,22 +1588,8 @@
   */
  public boolean isWithinScope(final Entry entry)
  {
    if (isDNWithinScope(entry.getName()))
    {
      if (refinements != null)
      {
        return refinements.matches(entry);
      }
      else
      {
        return true;
      }
    }
    else
    {
      return false;
    }
    return isDNWithinScope(entry.getName())
        && (refinements == null || refinements.matches(entry));
  }
opendj-server/src/main/java/org/forgerock/opendj/server/core/DataProviderID.java
@@ -22,7 +22,7 @@
 *
 *
 *       Copyright 2008 Sun Microsystems, Inc.
 *       Portions copyright 2013 ForgeRock AS.
 *       Portions copyright 2013-2015 ForgeRock AS.
 */
package org.forgerock.opendj.server.core;
@@ -100,11 +100,8 @@
            return true;
        } else if (obj instanceof DataProviderID) {
            final DataProviderID other = (DataProviderID) obj;
            if (isInternal != other.isInternal) {
                return false;
            } else {
                return normalizedName.equals(other.normalizedName);
            }
            return isInternal == other.isInternal
                && normalizedName.equals(other.normalizedName);
        } else {
            return false;
        }