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/guitools/controlpanel/ui/VLVIndexPanel.java | 33
opendj-server-legacy/src/main/java/org/opends/server/extensions/FileBasedTrustManagerProvider.java | 20
opendj-server-legacy/src/main/java/org/opends/server/admin/client/ldap/LDAPDriver.java | 15
opendj-server-legacy/src/main/java/org/opends/server/backends/pluggable/Index.java | 9
opendj-server-legacy/src/main/java/org/opends/server/api/AuthenticationPolicyState.java | 12
opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/BrowseIndexPanel.java | 32
opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/NewVLVIndexPanel.java | 32
opendj-server-legacy/src/main/java/org/opends/server/workflowelement/localbackend/LocalBackendBindOperation.java | 28
opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/SimplifiedViewEntryPanel.java | 17
opendj-server-legacy/src/main/java/org/opends/server/admin/client/spi/PropertySet.java | 10
opendj-server-legacy/src/main/java/org/opends/server/replication/protocol/ModifyCommonMsg.java | 14
opendj-server-legacy/src/main/java/org/opends/server/authorization/dseecompat/PatternIP.java | 11
opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/task/ResetUserPasswordTask.java | 32
opendj-server-legacy/src/main/java/org/opends/server/admin/AggregationPropertyDefinition.java | 11
opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/NewGroupPanel.java | 14
opendj-server-legacy/src/main/java/org/opends/server/extensions/IsMemberOfVirtualAttributeProvider.java | 18
opendj-server-legacy/src/main/java/org/opends/server/tools/upgrade/FileManager.java | 19
opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/TableViewEntryPanel.java | 18
opendj-server-legacy/src/main/java/org/opends/quicksetup/installer/InstallerHelper.java | 20
opendj-server-legacy/src/main/java/org/opends/server/backends/jeb/BackupManager.java | 25
opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/event/BrowseActionListener.java | 20
opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/datamodel/BaseDNDescriptor.java | 56
opendj-server-legacy/src/main/java/org/opends/server/protocols/http/HTTPConnectionHandler.java | 22
opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/datamodel/CategorizedComboBoxElement.java | 15
opendj-server-legacy/src/main/java/org/opends/quicksetup/util/ZipExtractor.java | 8
opendj-server-legacy/src/dsml/org/opends/dsml/protocol/DSMLServlet.java | 60
opendj-server-legacy/src/main/java/org/opends/guitools/uninstaller/Uninstaller.java | 11
opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/BrowseSchemaPanel.java | 21
opendj-server-legacy/src/main/java/org/opends/quicksetup/installer/ui/JavaArgumentsDialog.java | 13
opendj-server-legacy/src/main/java/org/opends/server/plugins/SambaPasswordPlugin.java | 30
opendj-server-legacy/src/main/java/org/opends/server/backends/pluggable/BackupManager.java | 25
opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/components/DoubleAddRemovePanel.java | 8
opendj-server-legacy/src/main/java/org/opends/server/backends/task/TaskScheduler.java | 16
opendj-server-legacy/src/main/java/org/opends/server/util/LDIFReader.java | 15
opendj-server-legacy/src/main/java/org/opends/server/tasks/BackupTask.java | 11
opendj-server-legacy/src/main/java/org/opends/server/admin/SizePropertyDefinition.java | 15
opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/ImportLDIFPanel.java | 14
opendj-server-legacy/src/main/java/org/opends/server/backends/pluggable/PresenceIndexer.java | 9
opendj-server-legacy/src/main/java/org/opends/server/protocols/http/HTTPClientConnection.java | 9
opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/datamodel/BinaryValue.java | 15
opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/WindowsServicePanel.java | 20
opendj-server-legacy/src/main/java/org/opends/admin/ads/ADSContext.java | 25
opendj-server-legacy/src/main/java/org/opends/server/backends/jeb/PresenceIndexer.java | 9
opendj-server-legacy/src/main/java/org/opends/server/extensions/DictionaryPasswordValidator.java | 25
opendj-server-legacy/src/main/java/org/opends/admin/ads/ADSContextHelper.java | 23
opendj-server-legacy/src/main/java/org/opends/server/protocols/ldap/LDAPClientConnection.java | 9
opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/BrowseEntriesPanel.java | 15
opendj-server-legacy/src/main/java/org/opends/quicksetup/util/FileManager.java | 22
opendj-server-legacy/src/main/java/org/opends/server/workflowelement/localbackend/LocalBackendCompareOperation.java | 14
opendj-server-legacy/src/main/java/org/opends/server/replication/server/SafeReadExpectedAcksInfo.java | 9
opendj-server-legacy/src/main/java/org/opends/server/core/EntryCacheConfigManager.java | 27
opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/components/CustomTree.java | 28
opendj-server-legacy/src/main/java/org/opends/server/extensions/LDAPPassThroughAuthenticationPolicyFactory.java | 8
opendj-server-legacy/src/main/java/org/opends/server/tools/ConfigureDS.java | 14
opendj-server-legacy/src/main/java/org/opends/server/config/ConfigAttribute.java | 10
opendj-server-legacy/src/main/java/org/opends/server/admin/server/ServerManagementContext.java | 13
opendj-server-legacy/src/main/java/org/opends/guitools/uninstaller/ui/ConfirmUninstallPanel.java | 18
opendj-server-legacy/src/main/java/org/opends/server/loggers/ZIPAction.java | 11
opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/AbstractBrowseEntriesPanel.java | 22
opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/datamodel/IndexDescriptor.java | 41
opendj-server-legacy/src/main/java/org/opends/server/loggers/GZIPAction.java | 11
opendj-server-legacy/src/main/java/org/opends/server/authorization/dseecompat/AciHandler.java | 40
opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/task/CancelTaskTask.java | 26
opendj-server-legacy/src/main/java/org/opends/server/controls/MatchedValuesFilter.java | 25
opendj-server-legacy/src/main/java/org/opends/server/admin/DurationPropertyDefinition.java | 38
opendj-server-legacy/src/main/java/org/opends/quicksetup/ui/CertificateDialog.java | 12
opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/task/DeleteEntryTask.java | 28
opendj-server-legacy/src/main/java/org/opends/server/admin/PropertyDefinition.java | 8
opendj-server-legacy/src/main/java/org/opends/server/tools/WaitForFileDelete.java | 29
opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/util/ConfigFromFile.java | 9
opendj-server-legacy/src/main/java/org/opends/server/admin/doc/ConfigGuideGeneration.java | 23
opendj-server-legacy/src/main/java/org/opends/server/protocols/ldap/LDAPConnectionHandler.java | 33
opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/CustomAttributePanel.java | 10
opendj-server-legacy/src/main/java/org/opends/server/admin/IntegerPropertyDefinition.java | 15
opendj-server-legacy/src/main/java/org/opends/server/authorization/dseecompat/TargetAttr.java | 87 -
opendj-server-legacy/src/main/java/org/opends/server/loggers/AbstractTextAccessLogPublisher.java | 52
opendj-server-legacy/src/main/java/org/opends/quicksetup/ui/GuiApplication.java | 17
opendj-server-legacy/src/main/java/org/opends/server/tools/makeldif/Template.java | 8
opendj-server-legacy/src/main/java/org/opends/server/util/StaticUtils.java | 11
opendj-server-legacy/src/main/java/org/opends/server/types/Schema.java | 72 -
opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/task/ModifyEntryTask.java | 30
opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/task/AddToGroupTask.java | 30
opendj-server-legacy/src/main/java/org/opends/server/tools/makeldif/MakeLDIFInputStream.java | 21
opendj-server-legacy/src/main/java/org/opends/server/types/SearchFilter.java | 21
opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/datamodel/VLVIndexDescriptor.java | 48
opendj-server-legacy/src/main/java/org/opends/server/core/PasswordPolicyConfigManager.java | 22
opendj-server-legacy/src/main/java/org/opends/server/replication/protocol/HeartbeatThread.java | 12
opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/components/FilterTextField.java | 7
opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/NewUserPanel.java | 13
opendj-server-legacy/src/main/java/org/opends/server/extensions/PasswordModifyExtendedOperation.java | 10
opendj-server-legacy/src/main/java/org/opends/quicksetup/event/BrowseActionListener.java | 20
opendj-server-legacy/src/main/java/org/opends/server/tools/BackUpDB.java | 19
opendj-server-legacy/src/main/java/org/opends/server/replication/server/changelog/file/Log.java | 7
opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/AbstractVLVIndexPanel.java | 23
opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/NewObjectClassPanel.java | 9
opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/RebuildIndexPanel.java | 11
opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/JavaPropertiesPanel.java | 49
opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/NewBaseDNPanel.java | 14
opendj-server-legacy/src/main/java/org/opends/server/authorization/dseecompat/AciContainer.java | 16
opendj-server-legacy/src/main/java/org/opends/server/extensions/AttributeValuePasswordValidator.java | 12
opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/task/NewEntryTask.java | 30
101 files changed, 868 insertions(+), 1,256 deletions(-)
diff --git a/opendj-server-legacy/src/dsml/org/opends/dsml/protocol/DSMLServlet.java b/opendj-server-legacy/src/dsml/org/opends/dsml/protocol/DSMLServlet.java
index 26a340a..bc42504 100644
--- a/opendj-server-legacy/src/dsml/org/opends/dsml/protocol/DSMLServlet.java
+++ b/opendj-server-legacy/src/dsml/org/opends/dsml/protocol/DSMLServlet.java
@@ -388,35 +388,34 @@
} else {
throw new ServletException("Content-Type does not match SOAP 1.1 or SOAP 1.2");
}
- } else if (headerName.equalsIgnoreCase("authorization")) {
- if (headerVal.startsWith("Basic ")) {
- authenticationInHeader = true;
- String authorization = headerVal.substring(6).trim();
- try {
- String unencoded = new String(Base64.decode(authorization));
- int colon = unencoded.indexOf(':');
- if (colon > 0) {
- if (useHTTPAuthzID)
- {
- connOptions.setSASLMechanism("mech=" + SASL_MECHANISM_PLAIN);
- connOptions.addSASLProperty(
- "authid=u:" + unencoded.substring(0, colon).trim());
- authenticationIsID = true;
- }
- else
- {
- bindDN = unencoded.substring(0, colon).trim();
- }
- bindPassword = unencoded.substring(colon + 1);
+ } else if (headerName.equalsIgnoreCase("authorization") && headerVal.startsWith("Basic "))
+ {
+ authenticationInHeader = true;
+ String authorization = headerVal.substring(6).trim();
+ try {
+ String unencoded = new String(Base64.decode(authorization));
+ int colon = unencoded.indexOf(':');
+ if (colon > 0) {
+ if (useHTTPAuthzID)
+ {
+ connOptions.setSASLMechanism("mech=" + SASL_MECHANISM_PLAIN);
+ connOptions.addSASLProperty(
+ "authid=u:" + unencoded.substring(0, colon).trim());
+ authenticationIsID = true;
}
- } catch (ParseException ex) {
- // user/DN:password parsing error
- batchResponses.add(
- createErrorResponse(
- new LDAPException(LDAPResultCode.INVALID_CREDENTIALS,
- LocalizableMessage.raw(ex.getMessage()))));
- break;
+ else
+ {
+ bindDN = unencoded.substring(0, colon).trim();
+ }
+ bindPassword = unencoded.substring(colon + 1);
}
+ } catch (ParseException ex) {
+ // user/DN:password parsing error
+ batchResponses.add(
+ createErrorResponse(
+ new LDAPException(LDAPResultCode.INVALID_CREDENTIALS,
+ LocalizableMessage.raw(ex.getMessage()))));
+ break;
}
}
StringTokenizer tk = new StringTokenizer(headerVal, ",");
@@ -560,10 +559,9 @@
if ( code != LDAPResultCode.SUCCESS
&& code != LDAPResultCode.REFERRAL
&& code != LDAPResultCode.COMPARE_TRUE
- && code != LDAPResultCode.COMPARE_FALSE ) {
- if ( ON_ERROR_EXIT.equals(batchRequest.getOnError()) ) {
- break;
- }
+ && code != LDAPResultCode.COMPARE_FALSE && ON_ERROR_EXIT.equals(batchRequest.getOnError()) )
+ {
+ break;
}
}
}
diff --git a/opendj-server-legacy/src/main/java/org/opends/admin/ads/ADSContext.java b/opendj-server-legacy/src/main/java/org/opends/admin/ads/ADSContext.java
index 4dbde40..4dfad8d 100644
--- a/opendj-server-legacy/src/main/java/org/opends/admin/ads/ADSContext.java
+++ b/opendj-server-legacy/src/main/java/org/opends/admin/ads/ADSContext.java
@@ -567,16 +567,13 @@
{
Set<?> memberList =
(Set<?>)serverGroup.get(ServerGroupProperty.MEMBERS);
- if (memberList != null)
+ if (memberList != null && memberList.remove(member))
{
- if (memberList.remove(member))
- {
- HashMap<ServerGroupProperty, Object> serverGroupProperties =
- new HashMap<ServerGroupProperty, Object>();
- serverGroupProperties.put(ServerGroupProperty.MEMBERS, memberList);
- String groupName = (String)serverGroup.get(ServerGroupProperty.UID);
- updateServerGroup(groupName, serverGroupProperties);
- }
+ HashMap<ServerGroupProperty, Object> serverGroupProperties =
+ new HashMap<ServerGroupProperty, Object>();
+ serverGroupProperties.put(ServerGroupProperty.MEMBERS, memberList);
+ String groupName = (String)serverGroup.get(ServerGroupProperty.UID);
+ updateServerGroup(groupName, serverGroupProperties);
}
}
@@ -2119,16 +2116,12 @@
* @param serverProperties the server properties.
* @return the server ID for the given properties or null.
*/
- private static String getServerID(
- Map<ServerProperty, Object> serverProperties)
+ private static String getServerID(Map<ServerProperty, Object> serverProperties)
{
String result = (String) serverProperties.get(ServerProperty.ID);
- if (result != null)
+ if (result != null && result.length() == 0)
{
- if (result.length() == 0)
- {
- result = null;
- }
+ result = null;
}
return result;
}
diff --git a/opendj-server-legacy/src/main/java/org/opends/admin/ads/ADSContextHelper.java b/opendj-server-legacy/src/main/java/org/opends/admin/ads/ADSContextHelper.java
index 0b245b0..da6f084 100644
--- a/opendj-server-legacy/src/main/java/org/opends/admin/ads/ADSContextHelper.java
+++ b/opendj-server-legacy/src/main/java/org/opends/admin/ads/ADSContextHelper.java
@@ -22,7 +22,7 @@
*
*
* Copyright 2007-2010 Sun Microsystems, Inc.
- * Portions Copyright 2014 ForgeRock AS
+ * Portions Copyright 2014-2015 ForgeRock AS
*/
package org.opends.admin.ads;
@@ -100,20 +100,17 @@
if (backend != null)
{
SortedSet<DN> suffixes = backend.getBaseDN();
- if (suffixes != null)
+ if (suffixes != null
+ && suffixes.remove(DN.valueOf(ADSContext.getAdministrationSuffixDN())))
{
- if (suffixes.remove(
- DN.valueOf(ADSContext.getAdministrationSuffixDN())))
+ if (suffixes.size() > 0)
{
- if (suffixes.size() > 0)
- {
- backend.setBaseDN(suffixes);
- backend.commit();
- }
- else
- {
- root.removeBackend(backendName);
- }
+ backend.setBaseDN(suffixes);
+ backend.commit();
+ }
+ else
+ {
+ root.removeBackend(backendName);
}
}
}
diff --git a/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/datamodel/BaseDNDescriptor.java b/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/datamodel/BaseDNDescriptor.java
index 4571fe4..a154416 100644
--- a/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/datamodel/BaseDNDescriptor.java
+++ b/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/datamodel/BaseDNDescriptor.java
@@ -22,7 +22,7 @@
*
*
* Copyright 2008-2011 Sun Microsystems, Inc.
- * Portions Copyright 2011-2013 ForgeRock AS
+ * Portions Copyright 2011-2015 ForgeRock AS
*/
package org.opends.guitools.controlpanel.datamodel;
@@ -106,33 +106,30 @@
@Override
public boolean equals(Object v)
{
- boolean equals = false;
- if (this != v)
+ if (this == v)
{
- if (v instanceof BaseDNDescriptor)
- {
- BaseDNDescriptor desc = (BaseDNDescriptor)v;
- equals = (getType() == desc.getType()) &&
- getDn().equals(desc.getDn()) &&
- (getAgeOfOldestMissingChange() == desc.getAgeOfOldestMissingChange()) &&
- (getMissingChanges() == desc.getMissingChanges()) &&
- (getEntries() == desc.getEntries());
- if (equals)
- {
- if ((getBackend() != null) && (desc.getBackend() != null))
- {
- // Only compare the backend IDs. In this context is enough
- equals = getBackend().getBackendID().equals(
- desc.getBackend().getBackendID());
- }
- }
- }
+ return true;
}
- else
+ if (!(v instanceof BaseDNDescriptor))
{
- equals = true;
+ return false;
}
- return equals;
+
+ BaseDNDescriptor desc = (BaseDNDescriptor)v;
+ return getType() == desc.getType()
+ && getDn().equals(desc.getDn())
+ && getAgeOfOldestMissingChange() == desc.getAgeOfOldestMissingChange()
+ && getMissingChanges() == desc.getMissingChanges()
+ && getEntries() == desc.getEntries()
+ && backendIdEqual(desc);
+ }
+
+ private boolean backendIdEqual(BaseDNDescriptor desc)
+ {
+ // Only compare the backend IDs. In this context is enough
+ return getBackend() != null
+ && desc.getBackend() != null
+ && getBackend().getBackendID().equals(desc.getBackend().getBackendID());
}
/**
@@ -154,14 +151,11 @@
{
returnValue = getType().compareTo(desc.getType());
}
- if (returnValue == 0)
+ if (returnValue == 0 && getBackend() != null && desc.getBackend() != null)
{
- if ((getBackend() != null) && (desc.getBackend() != null))
- {
- // Only compare the backend IDs. In this context is enough
- returnValue = getBackend().getBackendID().compareTo(
- desc.getBackend().getBackendID());
- }
+ // Only compare the backend IDs. In this context is enough
+ returnValue = getBackend().getBackendID().compareTo(
+ desc.getBackend().getBackendID());
}
if (returnValue == 0)
{
diff --git a/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/datamodel/BinaryValue.java b/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/datamodel/BinaryValue.java
index ca91dfc..d3d2623 100644
--- a/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/datamodel/BinaryValue.java
+++ b/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/datamodel/BinaryValue.java
@@ -22,6 +22,7 @@
*
*
* Copyright 2008-2009 Sun Microsystems, Inc.
+ * Portions Copyright 2015 ForgeRock AS
*/
package org.opends.guitools.controlpanel.datamodel;
@@ -126,12 +127,9 @@
*/
public String getBase64()
{
- if (base64 == null)
+ if (base64 == null && bytes != null)
{
- if (bytes != null)
- {
- base64 = Base64.encode(bytes);
- }
+ base64 = Base64.encode(bytes);
}
return base64;
}
@@ -144,12 +142,9 @@
*/
public byte[] getBytes() throws ParseException
{
- if (bytes == null)
+ if (bytes == null && base64 != null)
{
- if (base64 != null)
- {
- bytes = Base64.decode(base64);
- }
+ bytes = Base64.decode(base64);
}
return bytes;
}
diff --git a/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/datamodel/CategorizedComboBoxElement.java b/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/datamodel/CategorizedComboBoxElement.java
index c2772d5..b601931 100644
--- a/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/datamodel/CategorizedComboBoxElement.java
+++ b/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/datamodel/CategorizedComboBoxElement.java
@@ -22,6 +22,7 @@
*
*
* Copyright 2008 Sun Microsystems, Inc.
+ * Portions Copyright 2015 ForgeRock AS
*/
package org.opends.guitools.controlpanel.datamodel;
@@ -88,17 +89,13 @@
*/
public boolean equals(Object o)
{
- boolean equals = false;
- if (o != null)
+ if (o instanceof CategorizedComboBoxElement)
{
- if (o instanceof CategorizedComboBoxElement)
- {
- CategorizedComboBoxElement desc = (CategorizedComboBoxElement)o;
- equals = (desc.getType() == getType()) &&
- (getValue().equals(desc.getValue()));
- }
+ CategorizedComboBoxElement desc = (CategorizedComboBoxElement)o;
+ return desc.getType() == getType()
+ && getValue().equals(desc.getValue());
}
- return equals;
+ return false;
}
/**
diff --git a/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/datamodel/IndexDescriptor.java b/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/datamodel/IndexDescriptor.java
index 1a391f6..a2a1df7 100644
--- a/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/datamodel/IndexDescriptor.java
+++ b/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/datamodel/IndexDescriptor.java
@@ -130,30 +130,27 @@
*/
public boolean equals(Object o)
{
- boolean equals = o == this;
- if (!equals)
+ if (o == this)
{
- equals = o instanceof IndexDescriptor;
- if (equals)
- {
- IndexDescriptor index = (IndexDescriptor)o;
- equals = index.getName().equalsIgnoreCase(getName()) &&
- index.isDatabaseIndex() == isDatabaseIndex() &&
- index.getTypes().equals(getTypes()) &&
- index.getEntryLimit() == getEntryLimit();
-
- if (equals)
- {
- if ((getBackend() != null) && (index.getBackend() != null))
- {
- // Only compare the backend IDs. In this context is enough
- equals = getBackend().getBackendID().equals(
- index.getBackend().getBackendID());
- }
- }
- }
+ return true;
}
- return equals;
+ if (!(o instanceof IndexDescriptor))
+ {
+ return false;
+ }
+ IndexDescriptor index = (IndexDescriptor)o;
+ return index.getName().equalsIgnoreCase(getName())
+ && index.isDatabaseIndex() == isDatabaseIndex()
+ && index.getTypes().equals(getTypes())
+ && index.getEntryLimit() == getEntryLimit()
+ && backendIdEqual(index);
+ }
+
+ private boolean backendIdEqual(IndexDescriptor index)
+ {
+ return getBackend() != null
+ && index.getBackend() != null
+ && getBackend().getBackendID().equals(index.getBackend().getBackendID());
}
/**
diff --git a/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/datamodel/VLVIndexDescriptor.java b/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/datamodel/VLVIndexDescriptor.java
index ddf6f55..1091316 100644
--- a/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/datamodel/VLVIndexDescriptor.java
+++ b/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/datamodel/VLVIndexDescriptor.java
@@ -127,32 +127,32 @@
*/
public boolean equals(Object o)
{
- boolean equals = o == this;
- if (!equals)
+ if (o == this)
{
- equals = o instanceof VLVIndexDescriptor;
- if (equals)
- {
- VLVIndexDescriptor index = (VLVIndexDescriptor)o;
- equals = index.getName().equalsIgnoreCase(getName()) &&
- index.getBaseDN().equals(getBaseDN()) &&
- index.getFilter().equals(getFilter()) &&
- index.getScope() == getScope() &&
- index.getSortOrder().equals(getSortOrder());
- if (equals)
- {
- if ((getBackend() != null) && (index.getBackend() != null))
- {
- // Only compare the backend IDs. In this context is better to
- // do this since the backend object contains some state (like
- // number entries) that can change.
- equals = getBackend().getBackendID().equals(
- index.getBackend().getBackendID());
- }
- }
- }
+ return true;
}
- return equals;
+ if (!(o instanceof VLVIndexDescriptor))
+ {
+ return false;
+ }
+
+ VLVIndexDescriptor index = (VLVIndexDescriptor)o;
+ return index.getName().equalsIgnoreCase(getName())
+ && index.getBaseDN().equals(getBaseDN())
+ && index.getFilter().equals(getFilter())
+ && index.getScope() == getScope()
+ && index.getSortOrder().equals(getSortOrder())
+ && backendIdEqual(index);
+ }
+
+ private boolean backendIdEqual(VLVIndexDescriptor index)
+ {
+ return getBackend() != null
+ && index.getBackend() != null
+ // Only compare the backend IDs. In this context is better to
+ // do this since the backend object contains some state (like
+ // number entries) that can change.
+ && getBackend().getBackendID().equals(index.getBackend().getBackendID());
}
/**
diff --git a/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/event/BrowseActionListener.java b/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/event/BrowseActionListener.java
index 8d2203b..251c4fa 100644
--- a/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/event/BrowseActionListener.java
+++ b/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/event/BrowseActionListener.java
@@ -22,6 +22,7 @@
*
*
* Copyright 2008-2009 Sun Microsystems, Inc.
+ * Portions Copyright 2015 ForgeRock AS
*/
package org.opends.guitools.controlpanel.event;
@@ -195,19 +196,16 @@
/* If we can get the current field parent directory set to it */
String path = field.getText();
- if (path != null)
+ if (path != null && path.trim().length() > 0)
{
- if (path.trim().length() > 0)
+ File f = new File(path);
+ while ((f != null) && !f.isDirectory())
{
- File f = new File(path);
- while ((f != null) && !f.isDirectory())
- {
- f = f.getParentFile();
- }
- if (f != null)
- {
- fc.setCurrentDirectory(f);
- }
+ f = f.getParentFile();
+ }
+ if (f != null)
+ {
+ fc.setCurrentDirectory(f);
}
}
diff --git a/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/task/AddToGroupTask.java b/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/task/AddToGroupTask.java
index 4556583..74bbbc9 100644
--- a/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/task/AddToGroupTask.java
+++ b/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/task/AddToGroupTask.java
@@ -22,7 +22,7 @@
*
*
* Copyright 2008-2010 Sun Microsystems, Inc.
- * Portions Copyright 2013-2014 ForgeRock AS.
+ * Portions Copyright 2013-2015 ForgeRock AS.
*/
package org.opends.guitools.controlpanel.task;
@@ -147,26 +147,22 @@
public boolean canLaunch(Task taskToBeLaunched,
Collection<LocalizableMessage> incompatibilityReasons)
{
- boolean canLaunch = true;
- if (!isServerRunning())
+ if (!isServerRunning()
+ && state == State.RUNNING
+ && runningOnSameServer(taskToBeLaunched))
{
- if (state == State.RUNNING && runningOnSameServer(taskToBeLaunched))
+ // All the operations are incompatible if they apply to this
+ // backend for safety. This is a short operation so the limitation
+ // has not a lot of impact.
+ Set<String> backends = new TreeSet<String>(taskToBeLaunched.getBackends());
+ backends.retainAll(getBackends());
+ if (backends.size() > 0)
{
- // All the operations are incompatible if they apply to this
- // backend for safety. This is a short operation so the limitation
- // has not a lot of impact.
- Set<String> backends =
- new TreeSet<String>(taskToBeLaunched.getBackends());
- backends.retainAll(getBackends());
- if (backends.size() > 0)
- {
- incompatibilityReasons.add(getIncompatibilityMessage(this,
- taskToBeLaunched));
- canLaunch = false;
- }
+ incompatibilityReasons.add(getIncompatibilityMessage(this, taskToBeLaunched));
+ return false;
}
}
- return canLaunch;
+ return true;
}
/**
diff --git a/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/task/CancelTaskTask.java b/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/task/CancelTaskTask.java
index 954de08..43ac29c 100644
--- a/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/task/CancelTaskTask.java
+++ b/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/task/CancelTaskTask.java
@@ -142,26 +142,20 @@
public boolean canLaunch(Task taskToBeLaunched,
Collection<LocalizableMessage> incompatibilityReasons)
{
- boolean canLaunch = true;
- if (!isServerRunning())
+ if (!isServerRunning() && state == State.RUNNING)
{
- if (state == State.RUNNING)
+ // All the operations are incompatible if they apply to this
+ // backend for safety. This is a short operation so the limitation
+ // has not a lot of impact.
+ Set<String> backends = new TreeSet<String>(taskToBeLaunched.getBackends());
+ backends.retainAll(getBackends());
+ if (backends.size() > 0)
{
- // All the operations are incompatible if they apply to this
- // backend for safety. This is a short operation so the limitation
- // has not a lot of impact.
- Set<String> backends =
- new TreeSet<String>(taskToBeLaunched.getBackends());
- backends.retainAll(getBackends());
- if (backends.size() > 0)
- {
- incompatibilityReasons.add(getIncompatibilityMessage(this,
- taskToBeLaunched));
- canLaunch = false;
- }
+ incompatibilityReasons.add(getIncompatibilityMessage(this, taskToBeLaunched));
+ return false;
}
}
- return canLaunch;
+ return true;
}
/**
diff --git a/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/task/DeleteEntryTask.java b/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/task/DeleteEntryTask.java
index 5ad6bac..0777d6b 100644
--- a/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/task/DeleteEntryTask.java
+++ b/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/task/DeleteEntryTask.java
@@ -179,25 +179,23 @@
public boolean canLaunch(Task taskToBeLaunched,
Collection<LocalizableMessage> incompatibilityReasons)
{
- boolean canLaunch = true;
- if (!isServerRunning())
+ if (!isServerRunning()
+ && state == State.RUNNING
+ && runningOnSameServer(taskToBeLaunched))
{
- if (state == State.RUNNING && runningOnSameServer(taskToBeLaunched))
+ // All the operations are incompatible if they apply to this
+ // backend for safety.
+ Set<String> backends =
+ new TreeSet<String>(taskToBeLaunched.getBackends());
+ backends.retainAll(getBackends());
+ if (backends.size() > 0)
{
- // All the operations are incompatible if they apply to this
- // backend for safety.
- Set<String> backends =
- new TreeSet<String>(taskToBeLaunched.getBackends());
- backends.retainAll(getBackends());
- if (backends.size() > 0)
- {
- incompatibilityReasons.add(getIncompatibilityMessage(this,
- taskToBeLaunched));
- canLaunch = false;
- }
+ incompatibilityReasons.add(getIncompatibilityMessage(this,
+ taskToBeLaunched));
+ return false;
}
}
- return canLaunch;
+ return true;
}
/**
diff --git a/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/task/ModifyEntryTask.java b/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/task/ModifyEntryTask.java
index 6c2660a..d8c8d98 100644
--- a/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/task/ModifyEntryTask.java
+++ b/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/task/ModifyEntryTask.java
@@ -200,26 +200,24 @@
public boolean canLaunch(Task taskToBeLaunched,
Collection<LocalizableMessage> incompatibilityReasons)
{
- boolean canLaunch = true;
- if (!isServerRunning())
+ if (!isServerRunning()
+ && state == State.RUNNING
+ && runningOnSameServer(taskToBeLaunched))
{
- if (state == State.RUNNING && runningOnSameServer(taskToBeLaunched))
+ // All the operations are incompatible if they apply to this
+ // backend for safety. This is a short operation so the limitation
+ // has not a lot of impact.
+ Set<String> backends =
+ new TreeSet<String>(taskToBeLaunched.getBackends());
+ backends.retainAll(getBackends());
+ if (backends.size() > 0)
{
- // All the operations are incompatible if they apply to this
- // backend for safety. This is a short operation so the limitation
- // has not a lot of impact.
- Set<String> backends =
- new TreeSet<String>(taskToBeLaunched.getBackends());
- backends.retainAll(getBackends());
- if (backends.size() > 0)
- {
- incompatibilityReasons.add(getIncompatibilityMessage(this,
- taskToBeLaunched));
- canLaunch = false;
- }
+ incompatibilityReasons.add(getIncompatibilityMessage(this,
+ taskToBeLaunched));
+ return false;
}
}
- return canLaunch;
+ return true;
}
/**
diff --git a/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/task/NewEntryTask.java b/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/task/NewEntryTask.java
index ad15ebb..1ecbe50 100644
--- a/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/task/NewEntryTask.java
+++ b/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/task/NewEntryTask.java
@@ -151,26 +151,24 @@
public boolean canLaunch(Task taskToBeLaunched,
Collection<LocalizableMessage> incompatibilityReasons)
{
- boolean canLaunch = true;
- if (!isServerRunning())
+ if (!isServerRunning()
+ && state == State.RUNNING
+ && runningOnSameServer(taskToBeLaunched))
{
- if (state == State.RUNNING && runningOnSameServer(taskToBeLaunched))
+ // All the operations are incompatible if they apply to this
+ // backend for safety. This is a short operation so the limitation
+ // has not a lot of impact.
+ Set<String> backends =
+ new TreeSet<String>(taskToBeLaunched.getBackends());
+ backends.retainAll(getBackends());
+ if (backends.size() > 0)
{
- // All the operations are incompatible if they apply to this
- // backend for safety. This is a short operation so the limitation
- // has not a lot of impact.
- Set<String> backends =
- new TreeSet<String>(taskToBeLaunched.getBackends());
- backends.retainAll(getBackends());
- if (backends.size() > 0)
- {
- incompatibilityReasons.add(getIncompatibilityMessage(this,
- taskToBeLaunched));
- canLaunch = false;
- }
+ incompatibilityReasons.add(getIncompatibilityMessage(this,
+ taskToBeLaunched));
+ return false;
}
}
- return canLaunch;
+ return true;
}
/**
diff --git a/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/task/ResetUserPasswordTask.java b/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/task/ResetUserPasswordTask.java
index 06a9b53..b95eadc 100644
--- a/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/task/ResetUserPasswordTask.java
+++ b/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/task/ResetUserPasswordTask.java
@@ -22,7 +22,7 @@
*
*
* Copyright 2008-2010 Sun Microsystems, Inc.
- * Portions Copyright 2014 ForgeRock AS
+ * Portions Copyright 2014-2015 ForgeRock AS
*/
package org.opends.guitools.controlpanel.task;
@@ -187,26 +187,24 @@
public boolean canLaunch(Task taskToBeLaunched,
Collection<LocalizableMessage> incompatibilityReasons)
{
- boolean canLaunch = true;
- if (!isServerRunning())
+ if (!isServerRunning()
+ && state == State.RUNNING
+ && runningOnSameServer(taskToBeLaunched))
{
- if (state == State.RUNNING && runningOnSameServer(taskToBeLaunched))
+ // All the operations are incompatible if they apply to this
+ // backend for safety. This is a short operation so the limitation
+ // has not a lot of impact.
+ Set<String> backends =
+ new TreeSet<String>(taskToBeLaunched.getBackends());
+ backends.retainAll(getBackends());
+ if (backends.size() > 0)
{
- // All the operations are incompatible if they apply to this
- // backend for safety. This is a short operation so the limitation
- // has not a lot of impact.
- Set<String> backends =
- new TreeSet<String>(taskToBeLaunched.getBackends());
- backends.retainAll(getBackends());
- if (backends.size() > 0)
- {
- incompatibilityReasons.add(getIncompatibilityMessage(this,
- taskToBeLaunched));
- canLaunch = false;
- }
+ incompatibilityReasons.add(getIncompatibilityMessage(this,
+ taskToBeLaunched));
+ return false;
}
}
- return canLaunch;
+ return true;
}
/**
diff --git a/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/AbstractBrowseEntriesPanel.java b/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/AbstractBrowseEntriesPanel.java
index e9e50e8..9c8acf5 100644
--- a/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/AbstractBrowseEntriesPanel.java
+++ b/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/AbstractBrowseEntriesPanel.java
@@ -22,7 +22,7 @@
*
*
* Copyright 2008-2010 Sun Microsystems, Inc.
- * Portions Copyright 2011-2014 ForgeRock AS
+ * Portions Copyright 2011-2015 ForgeRock AS
*/
package org.opends.guitools.controlpanel.ui;
@@ -353,13 +353,11 @@
for (int i=0; i<baseDNs.getModel().getSize(); i++)
{
Object item = baseDNs.getModel().getElementAt(i);
- if (item instanceof CategorizedComboBoxElement)
+ if (item instanceof CategorizedComboBoxElement
+ && !isCategory(item))
{
- if (!isCategory(item))
- {
- lastSelectedBaseDN = item;
- break;
- }
+ lastSelectedBaseDN = item;
+ break;
}
}
if (lastSelectedBaseDN != null)
@@ -1473,13 +1471,11 @@
{
try
{
- if (displayAll || isBaseDN)
+ if ((displayAll || isBaseDN)
+ && !controller.hasSuffix(dn))
{
- if (!controller.hasSuffix(dn))
- {
- controller.addSuffix(dn, null);
- added = true;
- }
+ controller.addSuffix(dn, null);
+ added = true;
}
}
catch (IllegalArgumentException iae)
diff --git a/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/AbstractVLVIndexPanel.java b/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/AbstractVLVIndexPanel.java
index 918df78..fa21c1d 100644
--- a/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/AbstractVLVIndexPanel.java
+++ b/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/AbstractVLVIndexPanel.java
@@ -666,13 +666,10 @@
if (index != null)
{
IndexType type = indexTypes[i];
- if (type != null)
+ if (type != null && !index.getTypes().contains(type))
{
- if (!index.getTypes().contains(type))
- {
- msgs.add(INFO_CTRL_PANEL_MUST_UPDATE_INDEX_DEFINITION_TYPE.get(
- filter.getAttributeType(), indexTypeNames[i]));
- }
+ msgs.add(INFO_CTRL_PANEL_MUST_UPDATE_INDEX_DEFINITION_TYPE.get(
+ filter.getAttributeType(), indexTypeNames[i]));
}
}
else
@@ -1214,15 +1211,13 @@
model.getElementAt(j);
if (o.getType() == CategorizedComboBoxElement.Type.REGULAR)
{
- if (dealingWithCustom == isCustom)
+ if (dealingWithCustom == isCustom
+ && attrName.compareTo(o.getValue().toString()) < 0)
{
- if (attrName.compareTo(o.getValue().toString()) < 0)
- {
- model.insertElementAt(new CategorizedComboBoxElement(
- attrName,
- CategorizedComboBoxElement.Type.REGULAR), j);
- break;
- }
+ model.insertElementAt(new CategorizedComboBoxElement(
+ attrName,
+ CategorizedComboBoxElement.Type.REGULAR), j);
+ break;
}
}
else if (!o.getValue().equals(CUSTOM_ATTRIBUTES))
diff --git a/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/BrowseEntriesPanel.java b/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/BrowseEntriesPanel.java
index 4732ff5..7aacff7 100644
--- a/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/BrowseEntriesPanel.java
+++ b/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/BrowseEntriesPanel.java
@@ -495,26 +495,23 @@
*/
private boolean hasUserPassword(String[] ocs)
{
- boolean hasUserPassword = false;
Schema schema = getInfo().getServerDescriptor().getSchema();
- if ((ocs != null) && (schema != null))
+ if (ocs != null && schema != null)
{
AttributeType attr = schema.getAttributeType(
ServerConstants.ATTR_USER_PASSWORD);
for (String oc : ocs)
{
ObjectClass objectClass = schema.getObjectClass(oc);
- if ((objectClass != null) && (attr != null))
+ if (objectClass != null
+ && attr != null
+ && objectClass.isRequiredOrOptional(attr))
{
- if (objectClass.isRequiredOrOptional(attr))
- {
- hasUserPassword = true;
- break;
- }
+ return true;
}
}
}
- return hasUserPassword;
+ return false;
}
/**
diff --git a/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/BrowseIndexPanel.java b/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/BrowseIndexPanel.java
index 6bd62fe..a0ce3e3 100644
--- a/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/BrowseIndexPanel.java
+++ b/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/BrowseIndexPanel.java
@@ -22,7 +22,7 @@
*
*
* Copyright 2008-2010 Sun Microsystems, Inc.
- * Portions Copyright 2014 ForgeRock AS
+ * Portions Copyright 2014-2015 ForgeRock AS
*/
package org.opends.guitools.controlpanel.ui;
@@ -683,14 +683,12 @@
lastCreatedIndex = null;
}
}
- else if ((node instanceof VLVIndexTreeNode) &&
- (lastCreatedIndex instanceof VLVIndexDescriptor))
+ else if (node instanceof VLVIndexTreeNode
+ && lastCreatedIndex instanceof VLVIndexDescriptor
+ && node.getName().equals(lastCreatedIndex.getName()))
{
- if (node.getName().equals(lastCreatedIndex.getName()))
- {
- newSelectionPath = new TreePath(node.getPath());
- lastCreatedIndex = null;
- }
+ newSelectionPath = new TreePath(node.getPath());
+ lastCreatedIndex = null;
}
}
else if (node.getName().equals(lastSelectedNode.getUserObject()))
@@ -709,12 +707,9 @@
i++;
}
- if (newSelectionPath == null)
+ if (newSelectionPath == null && firstTreeRepopulate)
{
- if (firstTreeRepopulate)
- {
- newSelectionPath = new TreePath(standardIndexes.getPath());
- }
+ newSelectionPath = new TreePath(standardIndexes.getPath());
}
if (newSelectionPath != null)
{
@@ -939,8 +934,7 @@
launchOperation(newTask,
INFO_CTRL_PANEL_DELETING_INDEXES_SUMMARY.get(),
INFO_CTRL_PANEL_DELETING_INDEXES_COMPLETE.get(),
- INFO_CTRL_PANEL_DELETING_INDEXES_SUCCESSFUL.get(nameLabel,
- backendName),
+ INFO_CTRL_PANEL_DELETING_INDEXES_SUCCESSFUL.get(nameLabel, backendName),
ERR_CTRL_PANEL_DELETING_INDEXES_ERROR_SUMMARY.get(),
ERR_CTRL_PANEL_DELETING_INDEXES_ERROR_DETAILS.get(nameLabel),
null,
@@ -1004,12 +998,10 @@
private ImageIcon getIcon(Object value)
{
ImageIcon icon = null;
- if (value instanceof IndexTreeNode)
+ if (value instanceof IndexTreeNode
+ && ((IndexTreeNode)value).getIndex().isDatabaseIndex())
{
- if (((IndexTreeNode)value).getIndex().isDatabaseIndex())
- {
- icon = readOnlyIndexIcon;
- }
+ icon = readOnlyIndexIcon;
}
if (icon == null)
{
diff --git a/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/BrowseSchemaPanel.java b/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/BrowseSchemaPanel.java
index ddb3667..8c9c9ab 100644
--- a/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/BrowseSchemaPanel.java
+++ b/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/BrowseSchemaPanel.java
@@ -983,14 +983,12 @@
lastCreatedElement = null;
}
}
- else if ((node instanceof CustomAttributeTreeNode) &&
- (lastCreatedElement instanceof AttributeType))
+ else if (node instanceof CustomAttributeTreeNode
+ && lastCreatedElement instanceof AttributeType
+ && name.equals(lastCreatedElement.getNameOrOID()))
{
- if (name.equals(lastCreatedElement.getNameOrOID()))
- {
- newSelectionPath = new TreePath(node.getPath());
- lastCreatedElement = null;
- }
+ newSelectionPath = new TreePath(node.getPath());
+ lastCreatedElement = null;
}
}
else if (name.equals(lastSelectedNode.getUserObject()))
@@ -1011,13 +1009,10 @@
DefaultMutableTreeNode[] ocAndAttrs = {objectClasses, attributes};
for (DefaultMutableTreeNode node : ocAndAttrs)
{
- if (node.getParent() != null)
+ if (node.getParent() != null && node.getChildCount() == 0)
{
- if (node.getChildCount() == 0)
- {
- model.removeNodeFromParent(node);
- model.nodeStructureChanged(node);
- }
+ model.removeNodeFromParent(node);
+ model.nodeStructureChanged(node);
}
}
diff --git a/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/CustomAttributePanel.java b/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/CustomAttributePanel.java
index af07931..29c24f8 100644
--- a/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/CustomAttributePanel.java
+++ b/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/CustomAttributePanel.java
@@ -1055,13 +1055,11 @@
}
setPrimaryValid(lUsage);
- if (nonModifiable.isSelected())
+ if (nonModifiable.isSelected()
+ && AttributeUsage.USER_APPLICATIONS.equals(usage.getSelectedItem()))
{
- if (AttributeUsage.USER_APPLICATIONS.equals(usage.getSelectedItem()))
- {
- errors.add(ERR_NON_MODIFIABLE_CANNOT_BE_USER_APPLICATIONS.get());
- setPrimaryInvalid(lUsage);
- }
+ errors.add(ERR_NON_MODIFIABLE_CANNOT_BE_USER_APPLICATIONS.get());
+ setPrimaryInvalid(lUsage);
}
if (errors.isEmpty())
diff --git a/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/ImportLDIFPanel.java b/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/ImportLDIFPanel.java
index ea1e28d..384529a 100644
--- a/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/ImportLDIFPanel.java
+++ b/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/ImportLDIFPanel.java
@@ -22,7 +22,7 @@
*
*
* Copyright 2008-2010 Sun Microsystems, Inc.
- * Portions Copyright 2014 ForgeRock AS
+ * Portions Copyright 2014-2015 ForgeRock AS
*/
package org.opends.guitools.controlpanel.ui;
@@ -612,14 +612,12 @@
errors.add(ERR_CTRL_PANEL_REJECTS_FILE_REQUIRED.get());
setPrimaryInvalid(lRejectsFile);
}
- else if (writeSkips.isSelected())
+ else if (writeSkips.isSelected()
+ && new File(rejectPath).equals(new File(skipsFile.getText())))
{
- if (new File(rejectPath).equals(new File(skipsFile.getText())))
- {
- errors.add(ERR_CTRL_PANEL_REJECTS_AND_SKIPS_MUST_BE_DIFFERENT.get());
- setPrimaryInvalid(lRejectsFile);
- setPrimaryInvalid(lSkipsFile);
- }
+ errors.add(ERR_CTRL_PANEL_REJECTS_AND_SKIPS_MUST_BE_DIFFERENT.get());
+ setPrimaryInvalid(lRejectsFile);
+ setPrimaryInvalid(lSkipsFile);
}
}
diff --git a/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/JavaPropertiesPanel.java b/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/JavaPropertiesPanel.java
index 6b5e47b..1dc4744 100644
--- a/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/JavaPropertiesPanel.java
+++ b/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/JavaPropertiesPanel.java
@@ -1117,23 +1117,22 @@
@Override
public boolean equals(Object o)
{
- boolean equals = o == this;
- if (!equals)
+ if (o == this)
{
- if (o instanceof JavaArgumentsDescriptor)
- {
- equals =
- commandName.equals(((JavaArgumentsDescriptor)o).getCommandName()) &&
- javaArguments.equals(((JavaArgumentsDescriptor)o).getJavaArguments());
- }
+ return true;
}
- return equals;
+ if (!(o instanceof JavaArgumentsDescriptor))
+ {
+ return false;
+ }
+ JavaArgumentsDescriptor desc = (JavaArgumentsDescriptor)o;
+ return commandName.equals(desc.getCommandName())
+ && javaArguments.equals(desc.getJavaArguments());
}
}
/**
* The table model used to display the java arguments.
- *
*/
protected class JavaArgumentsTableModel extends SortableTableModel
implements Comparator<JavaArgumentsDescriptor>
@@ -1435,26 +1434,24 @@
public boolean canLaunch(Task taskToBeLaunched,
Collection<LocalizableMessage> incompatibilityReasons)
{
- boolean canLaunch = true;
- if (!isServerRunning())
+ if (!isServerRunning()
+ && state == State.RUNNING
+ && runningOnSameServer(taskToBeLaunched))
{
- if (state == State.RUNNING && runningOnSameServer(taskToBeLaunched))
+ // All the operations are incompatible if they apply to this
+ // backend for safety. This is a short operation so the limitation
+ // has not a lot of impact.
+ Set<String> backends =
+ new TreeSet<String>(taskToBeLaunched.getBackends());
+ backends.retainAll(getBackends());
+ if (backends.size() > 0)
{
- // All the operations are incompatible if they apply to this
- // backend for safety. This is a short operation so the limitation
- // has not a lot of impact.
- Set<String> backends =
- new TreeSet<String>(taskToBeLaunched.getBackends());
- backends.retainAll(getBackends());
- if (backends.size() > 0)
- {
- incompatibilityReasons.add(getIncompatibilityMessage(this,
- taskToBeLaunched));
- canLaunch = false;
- }
+ incompatibilityReasons.add(getIncompatibilityMessage(this,
+ taskToBeLaunched));
+ return false;
}
}
- return canLaunch;
+ return true;
}
/**
diff --git a/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/NewBaseDNPanel.java b/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/NewBaseDNPanel.java
index 4994d5d..49514fc 100644
--- a/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/NewBaseDNPanel.java
+++ b/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/NewBaseDNPanel.java
@@ -564,15 +564,13 @@
break;
}
}
- else if (theDN.isAncestorOf(baseDN.getDn()))
+ else if (theDN.isAncestorOf(baseDN.getDn())
+ && backendName.equalsIgnoreCase(backend.getBackendID()))
{
- if (backendName.equalsIgnoreCase(backend.getBackendID()))
- {
- errors.add(ERR_BASE_DN_DN_IS_ANCESTOR_OF.get(baseDN.getDn()));
- setPrimaryInvalid(lDirectoryBaseDN);
- baseDNAlreadyDefined = true;
- break;
- }
+ errors.add(ERR_BASE_DN_DN_IS_ANCESTOR_OF.get(baseDN.getDn()));
+ setPrimaryInvalid(lDirectoryBaseDN);
+ baseDNAlreadyDefined = true;
+ break;
}
}
if (baseDNAlreadyDefined)
diff --git a/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/NewGroupPanel.java b/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/NewGroupPanel.java
index 5f1b0d5..f39dfaa 100644
--- a/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/NewGroupPanel.java
+++ b/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/NewGroupPanel.java
@@ -22,7 +22,7 @@
*
*
* Copyright 2008-2010 Sun Microsystems, Inc.
- * Portions Copyright 2013-2014 ForgeRock AS.
+ * Portions Copyright 2013-2015 ForgeRock AS.
*/
package org.opends.guitools.controlpanel.ui;
@@ -622,14 +622,12 @@
staticMembers.setText(sb.toString());
staticMembers.setCaretPosition(sb.length());
}
- else if (comp == referenceGroup)
+ else if (comp == referenceGroup
+ && nodes.getNodes().length > 0)
{
- if (nodes.getNodes().length > 0)
- {
- String dn = nodes.getNodes()[0].getNode().getDN();
- referenceGroup.setText(dn);
- referenceGroup.setCaretPosition(dn.length());
- }
+ String dn = nodes.getNodes()[0].getNode().getDN();
+ referenceGroup.setText(dn);
+ referenceGroup.setCaretPosition(dn.length());
}
e.acceptDrop(DnDConstants.ACTION_COPY_OR_MOVE);
e.getDropTargetContext().dropComplete(true);
diff --git a/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/NewObjectClassPanel.java b/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/NewObjectClassPanel.java
index 30ff0dd..19217d8 100644
--- a/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/NewObjectClassPanel.java
+++ b/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/NewObjectClassPanel.java
@@ -211,13 +211,10 @@
{
setEnabledOK(!error[0]);
errorPane.setVisible(error[0]);
- if (schema != null)
+ if (schema != null && schemaChanged)
{
- if (schemaChanged)
- {
- superiors.setSchema(schema);
- updateAttributes();
- }
+ superiors.setSchema(schema);
+ updateAttributes();
}
if (repack[0])
{
diff --git a/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/NewUserPanel.java b/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/NewUserPanel.java
index 649b153..12b8733 100644
--- a/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/NewUserPanel.java
+++ b/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/NewUserPanel.java
@@ -190,17 +190,14 @@
break;
}
}
- if (!isRequired)
+ if (!isRequired && attr.equalsIgnoreCase(NAMING_ATTRIBUTES[i]))
{
- if (attr.equalsIgnoreCase(NAMING_ATTRIBUTES[i]))
+ String value = NAMING_ATTRIBUTE_TEXTFIELDS[i].getText().trim();
+ if (value.length() == 0)
{
- String value = NAMING_ATTRIBUTE_TEXTFIELDS[i].getText().trim();
- if (value.length() == 0)
- {
- errors.add(ERR_CTRL_PANEL_USER_NAMING_ATTRIBUTE_REQUIRED.get(attr));
- }
- break;
+ errors.add(ERR_CTRL_PANEL_USER_NAMING_ATTRIBUTE_REQUIRED.get(attr));
}
+ break;
}
}
diff --git a/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/NewVLVIndexPanel.java b/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/NewVLVIndexPanel.java
index 201c476..2a282d6 100644
--- a/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/NewVLVIndexPanel.java
+++ b/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/NewVLVIndexPanel.java
@@ -22,7 +22,7 @@
*
*
* Copyright 2008-2009 Sun Microsystems, Inc.
- * Portions Copyright 2014 ForgeRock AS
+ * Portions Copyright 2014-2015 ForgeRock AS
*/
package org.opends.guitools.controlpanel.ui;
@@ -145,24 +145,20 @@
{
task.canLaunch(newTask, errors);
}
- if (errors.isEmpty())
+ if (errors.isEmpty() && checkIndexRequired())
{
- // Check filters
- if (checkIndexRequired())
- {
- String indexName = name.getText().trim();
- launchOperation(newTask,
- INFO_CTRL_PANEL_CREATING_NEW_VLV_INDEX_SUMMARY.get(indexName),
- INFO_CTRL_PANEL_CREATING_NEW_VLV_INDEX_SUCCESSFUL_SUMMARY.get(),
- INFO_CTRL_PANEL_CREATING_NEW_VLV_INDEX_SUCCESSFUL_DETAILS.get(
- indexName),
- ERR_CTRL_PANEL_CREATING_NEW_VLV_INDEX_ERROR_SUMMARY.get(),
- ERR_CTRL_PANEL_CREATING_NEW_VLV_INDEX_ERROR_DETAILS.get(),
- null,
- dlg);
- dlg.setVisible(true);
- Utilities.getParentDialog(this).setVisible(false);
- }
+ String indexName = name.getText().trim();
+ launchOperation(newTask,
+ INFO_CTRL_PANEL_CREATING_NEW_VLV_INDEX_SUMMARY.get(indexName),
+ INFO_CTRL_PANEL_CREATING_NEW_VLV_INDEX_SUCCESSFUL_SUMMARY.get(),
+ INFO_CTRL_PANEL_CREATING_NEW_VLV_INDEX_SUCCESSFUL_DETAILS.get(
+ indexName),
+ ERR_CTRL_PANEL_CREATING_NEW_VLV_INDEX_ERROR_SUMMARY.get(),
+ ERR_CTRL_PANEL_CREATING_NEW_VLV_INDEX_ERROR_DETAILS.get(),
+ null,
+ dlg);
+ dlg.setVisible(true);
+ Utilities.getParentDialog(this).setVisible(false);
}
}
diff --git a/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/RebuildIndexPanel.java b/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/RebuildIndexPanel.java
index 632b951..901485a 100644
--- a/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/RebuildIndexPanel.java
+++ b/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/RebuildIndexPanel.java
@@ -22,7 +22,7 @@
*
*
* Copyright 2008-2009 Sun Microsystems, Inc.
- * Portions Copyright 2014 ForgeRock AS
+ * Portions Copyright 2014-2015 ForgeRock AS
*/
package org.opends.guitools.controlpanel.ui;
@@ -241,13 +241,10 @@
boolean allDisabled = false;
for (BackendDescriptor backend : desc.getBackends())
{
- if (displayBackend(backend))
+ if (displayBackend(backend) && backend.isEnabled())
{
- if (backend.isEnabled())
- {
- allDisabled = false;
- break;
- }
+ allDisabled = false;
+ break;
}
}
if (!allDisabled)
diff --git a/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/SimplifiedViewEntryPanel.java b/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/SimplifiedViewEntryPanel.java
index 216ea3d..d0e0fa4 100644
--- a/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/SimplifiedViewEntryPanel.java
+++ b/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/SimplifiedViewEntryPanel.java
@@ -485,12 +485,10 @@
if (values.size() == 1)
{
Object v = values.get(0);
- if (v instanceof String)
+ if (v instanceof String
+ && ((String) v).indexOf("\n") != -1)
{
- if (((String)v).indexOf("\n") != -1)
- {
- gbc.anchor = GridBagConstraints.NORTHWEST;
- }
+ gbc.anchor = GridBagConstraints.NORTHWEST;
}
}
}
@@ -1249,13 +1247,10 @@
{
String oc = (String)o;
ObjectClass objectClass = schema.getObjectClass(oc.toLowerCase());
- if (objectClass != null)
+ if (objectClass != null && objectClass.isRequired(attr))
{
- if (objectClass.isRequired(attr))
- {
- isRequired = true;
- break;
- }
+ isRequired = true;
+ break;
}
}
}
diff --git a/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/TableViewEntryPanel.java b/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/TableViewEntryPanel.java
index 234555c..490eb24 100644
--- a/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/TableViewEntryPanel.java
+++ b/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/TableViewEntryPanel.java
@@ -800,18 +800,16 @@
List<Object> values = new ArrayList<Object>();
for (AttributeValuePair valuePair : dataArray)
{
- if (valuePair.attrName.equalsIgnoreCase(attrName))
+ if (valuePair.attrName.equalsIgnoreCase(attrName)
+ && hasValue(valuePair))
{
- if (hasValue(valuePair))
+ if (valuePair.value instanceof Collection<?>)
{
- if (valuePair.value instanceof Collection<?>)
- {
- values.addAll((Collection<?>) valuePair.value);
- }
- else
- {
- values.add(valuePair.value);
- }
+ values.addAll((Collection<?>) valuePair.value);
+ }
+ else
+ {
+ values.add(valuePair.value);
}
}
}
diff --git a/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/VLVIndexPanel.java b/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/VLVIndexPanel.java
index d916695..3fd743d 100644
--- a/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/VLVIndexPanel.java
+++ b/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/VLVIndexPanel.java
@@ -22,7 +22,7 @@
*
*
* Copyright 2008-2009 Sun Microsystems, Inc.
- * Portions Copyright 2011-2014 ForgeRock AS
+ * Portions Copyright 2011-2015 ForgeRock AS
*/
package org.opends.guitools.controlpanel.ui;
@@ -461,25 +461,20 @@
{
task.canLaunch(newModifyTask, errors);
}
- if (errors.isEmpty())
+ if (errors.isEmpty() && checkIndexRequired())
{
- // Check filters
- if (checkIndexRequired())
- {
- String indexName = index.getName();
- String backendName = index.getBackend().getBackendID();
- launchOperation(newModifyTask,
- INFO_CTRL_PANEL_MODIFYING_VLV_INDEX_SUMMARY.get(indexName),
- INFO_CTRL_PANEL_MODIFYING_VLV_INDEX_COMPLETE.get(),
- INFO_CTRL_PANEL_MODIFYING_VLV_INDEX_SUCCESSFUL.get(indexName,
- backendName),
- ERR_CTRL_PANEL_MODIFYING_VLV_INDEX_ERROR_SUMMARY.get(),
- ERR_CTRL_PANEL_MODIFYING_VLV_INDEX_ERROR_DETAILS.get(indexName),
- null,
- dlg);
- saveChanges.setEnabled(false);
- dlg.setVisible(true);
- }
+ String indexName = index.getName();
+ String backendName = index.getBackend().getBackendID();
+ launchOperation(newModifyTask,
+ INFO_CTRL_PANEL_MODIFYING_VLV_INDEX_SUMMARY.get(indexName),
+ INFO_CTRL_PANEL_MODIFYING_VLV_INDEX_COMPLETE.get(),
+ INFO_CTRL_PANEL_MODIFYING_VLV_INDEX_SUCCESSFUL.get(indexName, backendName),
+ ERR_CTRL_PANEL_MODIFYING_VLV_INDEX_ERROR_SUMMARY.get(),
+ ERR_CTRL_PANEL_MODIFYING_VLV_INDEX_ERROR_DETAILS.get(indexName),
+ null,
+ dlg);
+ saveChanges.setEnabled(false);
+ dlg.setVisible(true);
}
}
diff --git a/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/WindowsServicePanel.java b/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/WindowsServicePanel.java
index 75fd5f5..9588fe2 100644
--- a/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/WindowsServicePanel.java
+++ b/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/WindowsServicePanel.java
@@ -22,7 +22,7 @@
*
*
* Copyright 2008-2009 Sun Microsystems, Inc.
- * Portions Copyright 2014 ForgeRock AS
+ * Portions Copyright 2014-2015 ForgeRock AS
*/
package org.opends.guitools.controlpanel.ui;
@@ -341,18 +341,16 @@
public boolean canLaunch(Task taskToBeLaunched,
Collection<LocalizableMessage> incompatibilityReasons)
{
- boolean canLaunch = true;
- if (state == State.RUNNING && runningOnSameServer(taskToBeLaunched))
+ Type type = taskToBeLaunched.getType();
+ if (state == State.RUNNING
+ && runningOnSameServer(taskToBeLaunched)
+ && (type == Type.ENABLE_WINDOWS_SERVICE
+ || type == Type.DISABLE_WINDOWS_SERVICE))
{
- if ((taskToBeLaunched.getType() == Type.ENABLE_WINDOWS_SERVICE) ||
- (taskToBeLaunched.getType() == Type.DISABLE_WINDOWS_SERVICE))
- {
- incompatibilityReasons.add(getIncompatibilityMessage(this,
- taskToBeLaunched));
- canLaunch = false;
- }
+ incompatibilityReasons.add(getIncompatibilityMessage(this, taskToBeLaunched));
+ return false;
}
- return canLaunch;
+ return true;
}
/**
diff --git a/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/components/CustomTree.java b/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/components/CustomTree.java
index 1160af4..76a6b57 100644
--- a/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/components/CustomTree.java
+++ b/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/components/CustomTree.java
@@ -22,7 +22,7 @@
*
*
* Copyright 2008 Sun Microsystems, Inc.
- * Portions Copyright 2014 ForgeRock AS
+ * Portions Copyright 2014-2015 ForgeRock AS
*/
package org.opends.guitools.controlpanel.ui.components;
@@ -181,12 +181,12 @@
notifyNewEvent(macEvent, NewEventType.MOUSE_PRESSED);
}
- if (ev.isPopupTrigger() && (popupMenu != null)) {
- if ((getPathForLocation(ev.getPoint().x, ev.getPoint().y) != null) ||
- (newEvent != null))
- {
- popupMenu.show(ev.getComponent(), ev.getX(), ev.getY());
- }
+ if (ev.isPopupTrigger()
+ && popupMenu != null
+ && (getPathForLocation(ev.getPoint().x, ev.getPoint().y) != null
+ || newEvent != null))
+ {
+ popupMenu.show(ev.getComponent(), ev.getX(), ev.getY());
}
if (newEvent != null)
{
@@ -204,13 +204,13 @@
return;
}
MouseEvent newEvent = getTranslatedEvent(ev);
- if (ev.isPopupTrigger() && (popupMenu != null) &&
- !popupMenu.isVisible()) {
- if ((getPathForLocation(ev.getPoint().x, ev.getPoint().y) != null) ||
- (newEvent != null))
- {
- popupMenu.show(ev.getComponent(), ev.getX(), ev.getY());
- }
+ if (ev.isPopupTrigger()
+ && popupMenu != null
+ && !popupMenu.isVisible()
+ && (getPathForLocation(ev.getPoint().x, ev.getPoint().y) != null
+ || newEvent != null))
+ {
+ popupMenu.show(ev.getComponent(), ev.getX(), ev.getY());
}
if (newEvent != null)
diff --git a/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/components/DoubleAddRemovePanel.java b/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/components/DoubleAddRemovePanel.java
index 4bb0a16..fc28c2f 100644
--- a/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/components/DoubleAddRemovePanel.java
+++ b/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/components/DoubleAddRemovePanel.java
@@ -191,12 +191,10 @@
remove1Clicked();
}
}
- else if (e.getSource() == selectedList2)
+ else if (e.getSource() == selectedList2
+ && selectedList2.getSelectedValue() != null)
{
- if (selectedList2.getSelectedValue() != null)
- {
- remove2Clicked();
- }
+ remove2Clicked();
}
}
}
diff --git a/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/components/FilterTextField.java b/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/components/FilterTextField.java
index 826c0a2..998e05f 100644
--- a/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/components/FilterTextField.java
+++ b/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/components/FilterTextField.java
@@ -179,12 +179,9 @@
*/
public void setBorder(Border border)
{
- if (constructorBorderSet)
+ if (constructorBorderSet && border != null)
{
- if (border != null)
- {
- border = BorderFactory.createCompoundBorder(border, new IconBorder());
- }
+ border = BorderFactory.createCompoundBorder(border, new IconBorder());
}
super.setBorder(border);
}
diff --git a/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/util/ConfigFromFile.java b/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/util/ConfigFromFile.java
index b306349..9d72900 100644
--- a/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/util/ConfigFromFile.java
+++ b/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/util/ConfigFromFile.java
@@ -22,7 +22,7 @@
*
*
* Copyright 2008-2011 Sun Microsystems, Inc.
- * Portions Copyright 2013-2014 ForgeRock AS.
+ * Portions Copyright 2013-2015 ForgeRock AS.
*/
package org.opends.guitools.controlpanel.util;
@@ -373,12 +373,9 @@
ex.add(new OfflineUpdateException(ERR_READING_CONFIG_LDAP.get(t.getMessage()), t));
}
- if (ex.size() > 0)
+ if (ex.size() > 0 && environmentSettingException != null)
{
- if (environmentSettingException != null)
- {
- ex.add(0, environmentSettingException);
- }
+ ex.add(0, environmentSettingException);
}
for (OpenDsException oe : ex)
diff --git a/opendj-server-legacy/src/main/java/org/opends/guitools/uninstaller/Uninstaller.java b/opendj-server-legacy/src/main/java/org/opends/guitools/uninstaller/Uninstaller.java
index 287e520..ee4922b 100644
--- a/opendj-server-legacy/src/main/java/org/opends/guitools/uninstaller/Uninstaller.java
+++ b/opendj-server-legacy/src/main/java/org/opends/guitools/uninstaller/Uninstaller.java
@@ -22,7 +22,7 @@
*
*
* Copyright 2006-2010 Sun Microsystems, Inc.
- * Portions Copyright 2014 ForgeRock AS
+ * Portions Copyright 2014-2015 ForgeRock AS
*/
package org.opends.guitools.uninstaller;
@@ -389,13 +389,10 @@
@Override
public void run()
{
- if (startProgressDlg != null)
+ if (startProgressDlg != null && newLogDetail != null)
{
- if (newLogDetail != null)
- {
- startProgressDetails.append(newLogDetail);
- startProgressDlg.setDetails(startProgressDetails.toMessage());
- }
+ startProgressDetails.append(newLogDetail);
+ startProgressDlg.setDetails(startProgressDetails.toMessage());
}
}
});
diff --git a/opendj-server-legacy/src/main/java/org/opends/guitools/uninstaller/ui/ConfirmUninstallPanel.java b/opendj-server-legacy/src/main/java/org/opends/guitools/uninstaller/ui/ConfirmUninstallPanel.java
index 189162f..47eae32 100644
--- a/opendj-server-legacy/src/main/java/org/opends/guitools/uninstaller/ui/ConfirmUninstallPanel.java
+++ b/opendj-server-legacy/src/main/java/org/opends/guitools/uninstaller/ui/ConfirmUninstallPanel.java
@@ -22,7 +22,7 @@
*
*
* Copyright 2006-2010 Sun Microsystems, Inc.
- * Portions Copyright 2011-2014 ForgeRock AS
+ * Portions Copyright 2011-2015 ForgeRock AS
*/
package org.opends.guitools.uninstaller.ui;
@@ -90,24 +90,20 @@
{
case EXTERNAL_DB_DIRECTORIES:
Set<String> s1 = new HashSet<String>();
- if (outsideDbs.size() > 0)
+ if (outsideDbs.size() > 0
+ && getCheckBox(FieldName.EXTERNAL_DB_DIRECTORIES).isSelected())
{
- if (getCheckBox(FieldName.EXTERNAL_DB_DIRECTORIES).isSelected())
- {
- s1.addAll(outsideDbs);
- }
+ s1.addAll(outsideDbs);
}
value = s1;
break;
case EXTERNAL_LOG_FILES:
Set<String> s2 = new HashSet<String>();
- if (outsideLogs.size() > 0)
+ if (outsideLogs.size() > 0
+ && getCheckBox(FieldName.EXTERNAL_LOG_FILES).isSelected())
{
- if (getCheckBox(FieldName.EXTERNAL_LOG_FILES).isSelected())
- {
- s2.addAll(outsideLogs);
- }
+ s2.addAll(outsideLogs);
}
value = s2;
break;
diff --git a/opendj-server-legacy/src/main/java/org/opends/quicksetup/event/BrowseActionListener.java b/opendj-server-legacy/src/main/java/org/opends/quicksetup/event/BrowseActionListener.java
index bf1c358..d66e7d8 100644
--- a/opendj-server-legacy/src/main/java/org/opends/quicksetup/event/BrowseActionListener.java
+++ b/opendj-server-legacy/src/main/java/org/opends/quicksetup/event/BrowseActionListener.java
@@ -22,6 +22,7 @@
*
*
* Copyright 2006-2008 Sun Microsystems, Inc.
+ * Portions Copyright 2015 ForgeRock AS
*/
package org.opends.quicksetup.event;
@@ -161,19 +162,16 @@
/* If we can get the current field parent directory set to it */
String path = field.getText();
- if (path != null)
+ if (path != null && path.trim().length() > 0)
{
- if (path.trim().length() > 0)
+ File f = new File(path);
+ while ((f != null) && !f.isDirectory())
{
- File f = new File(path);
- while ((f != null) && !f.isDirectory())
- {
- f = f.getParentFile();
- }
- if (f != null)
- {
- fc.setCurrentDirectory(f);
- }
+ f = f.getParentFile();
+ }
+ if (f != null)
+ {
+ fc.setCurrentDirectory(f);
}
}
diff --git a/opendj-server-legacy/src/main/java/org/opends/quicksetup/installer/InstallerHelper.java b/opendj-server-legacy/src/main/java/org/opends/quicksetup/installer/InstallerHelper.java
index 132c9b2..0ef0e2e 100644
--- a/opendj-server-legacy/src/main/java/org/opends/quicksetup/installer/InstallerHelper.java
+++ b/opendj-server-legacy/src/main/java/org/opends/quicksetup/installer/InstallerHelper.java
@@ -1216,22 +1216,16 @@
*/
public String getImportProgressMessage(String msg)
{
- String parsedMsg = null;
- if (msg != null)
+ if (msg != null
+ && (msg.contains("msgID=" + JebMessages.NOTE_JEB_IMPORT_FINAL_STATUS.ordinal())
+ || msg.contains("msgID=" + JebMessages.NOTE_JEB_IMPORT_PROGRESS_REPORT.ordinal())))
{
- if ((msg.contains("msgID=" + JebMessages
- .NOTE_JEB_IMPORT_FINAL_STATUS.ordinal())) ||
- (msg.contains("msgID=" + JebMessages
- .NOTE_JEB_IMPORT_PROGRESS_REPORT.ordinal())))
+ int index = msg.indexOf("msg=");
+ if (index != -1)
{
- int index = msg.indexOf("msg=");
- if (index != -1)
- {
- parsedMsg = msg.substring(index + 4);
- }
+ return msg.substring(index + 4);
}
}
- return parsedMsg;
+ return null;
}
}
-
diff --git a/opendj-server-legacy/src/main/java/org/opends/quicksetup/installer/ui/JavaArgumentsDialog.java b/opendj-server-legacy/src/main/java/org/opends/quicksetup/installer/ui/JavaArgumentsDialog.java
index 41988ca..c0101ca 100644
--- a/opendj-server-legacy/src/main/java/org/opends/quicksetup/installer/ui/JavaArgumentsDialog.java
+++ b/opendj-server-legacy/src/main/java/org/opends/quicksetup/installer/ui/JavaArgumentsDialog.java
@@ -512,14 +512,13 @@
errorMsgs.add(ERR_MAX_MEMORY_VALUE.get());
setValidLater(lMaxMemory, false);
}
- if (maxMemory != -1 && initialMemory != -1)
+ if (maxMemory != -1
+ && initialMemory != -1
+ && initialMemory > maxMemory)
{
- if (initialMemory > maxMemory)
- {
- errorMsgs.add(ERR_MAX_MEMORY_BIGGER_THAN_INITIAL_MEMORY.get());
- setValidLater(lMaxMemory, false);
- setValidLater(lInitialMemory, false);
- }
+ errorMsgs.add(ERR_MAX_MEMORY_BIGGER_THAN_INITIAL_MEMORY.get());
+ setValidLater(lMaxMemory, false);
+ setValidLater(lInitialMemory, false);
}
if (errorMsgs.isEmpty())
{
diff --git a/opendj-server-legacy/src/main/java/org/opends/quicksetup/ui/CertificateDialog.java b/opendj-server-legacy/src/main/java/org/opends/quicksetup/ui/CertificateDialog.java
index 2aff363..139ec77 100644
--- a/opendj-server-legacy/src/main/java/org/opends/quicksetup/ui/CertificateDialog.java
+++ b/opendj-server-legacy/src/main/java/org/opends/quicksetup/ui/CertificateDialog.java
@@ -22,7 +22,7 @@
*
*
* Copyright 2008-2009 Sun Microsystems, Inc.
- * Portions Copyright 2013-2014 ForgeRock AS.
+ * Portions Copyright 2013-2015 ForgeRock AS.
*/
package org.opends.quicksetup.ui;
@@ -122,13 +122,11 @@
getContentPane().add(createPanel());
setModal(true);
pack();
- if (parent != null)
+ if (parent != null
+ && getPreferredSize().width > parent.getWidth())
{
- if (getPreferredSize().width > parent.getWidth())
- {
- setPreferredSize(new Dimension(Math.max(parent.getWidth() - 20, 600),
- getPreferredSize().height));
- }
+ setPreferredSize(new Dimension(Math.max(parent.getWidth() - 20, 600),
+ getPreferredSize().height));
}
pack();
int minWidth = (int) getPreferredSize().getWidth();
diff --git a/opendj-server-legacy/src/main/java/org/opends/quicksetup/ui/GuiApplication.java b/opendj-server-legacy/src/main/java/org/opends/quicksetup/ui/GuiApplication.java
index ff50bb0..c872455 100644
--- a/opendj-server-legacy/src/main/java/org/opends/quicksetup/ui/GuiApplication.java
+++ b/opendj-server-legacy/src/main/java/org/opends/quicksetup/ui/GuiApplication.java
@@ -452,18 +452,15 @@
"The host is null for the UserDataCertificateException"));
}
}
- if (acceptPermanently)
+ if (acceptPermanently && chain != null)
{
- if (chain != null)
+ try
{
- try
- {
- UIKeyStore.acceptCertificate(chain);
- }
- catch (Throwable t)
- {
- logger.warn(LocalizableMessage.raw("Error accepting certificate: "+t, t));
- }
+ UIKeyStore.acceptCertificate(chain);
+ }
+ catch (Throwable t)
+ {
+ logger.warn(LocalizableMessage.raw("Error accepting certificate: "+t, t));
}
}
}
diff --git a/opendj-server-legacy/src/main/java/org/opends/quicksetup/util/FileManager.java b/opendj-server-legacy/src/main/java/org/opends/quicksetup/util/FileManager.java
index 0b2f923..c110191 100644
--- a/opendj-server-legacy/src/main/java/org/opends/quicksetup/util/FileManager.java
+++ b/opendj-server-legacy/src/main/java/org/opends/quicksetup/util/FileManager.java
@@ -130,12 +130,11 @@
throws ApplicationException {
if (fileToRename != null && target != null) {
synchronized (target) {
- if (target.exists()) {
- if (!target.delete()) {
- throw new ApplicationException(
- ReturnCode.FILE_SYSTEM_ACCESS_ERROR,
- INFO_ERROR_DELETING_FILE.get(Utils.getPath(target)), null);
- }
+ if (target.exists() && !target.delete())
+ {
+ throw new ApplicationException(
+ ReturnCode.FILE_SYSTEM_ACCESS_ERROR,
+ INFO_ERROR_DELETING_FILE.get(Utils.getPath(target)), null);
}
}
if (!fileToRename.renameTo(target)) {
@@ -503,16 +502,11 @@
while ((i = fis.read(buf)) != -1) {
fos.write(buf, 0, i);
}
- if (destination.exists()) {
+ if (destination.exists() && isUnix()) {
// TODO: set the file's permissions. This is made easier in
// Java 1.6 but until then use the TestUtilities methods
- if (isUnix()) {
- String permissions =
- Utils.getFileSystemPermissions(objectFile);
- Utils.setPermissionsUnix(
- Utils.getPath(destination),
- permissions);
- }
+ String permissions = Utils.getFileSystemPermissions(objectFile);
+ Utils.setPermissionsUnix(Utils.getPath(destination), permissions);
}
if ((application != null) && application.isVerbose()) {
diff --git a/opendj-server-legacy/src/main/java/org/opends/quicksetup/util/ZipExtractor.java b/opendj-server-legacy/src/main/java/org/opends/quicksetup/util/ZipExtractor.java
index cd7a8aa..f39fcc2 100644
--- a/opendj-server-legacy/src/main/java/org/opends/quicksetup/util/ZipExtractor.java
+++ b/opendj-server-legacy/src/main/java/org/opends/quicksetup/util/ZipExtractor.java
@@ -325,11 +325,9 @@
{
throw new IOException("Could not create parent path: " + destination);
}
- if (application != null) {
- if (application.isVerbose())
- {
- application.notifyListenersDone(ratioWhenCompleted);
- }
+ if (application != null && application.isVerbose())
+ {
+ application.notifyListenersDone(ratioWhenCompleted);
}
}
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/admin/AggregationPropertyDefinition.java b/opendj-server-legacy/src/main/java/org/opends/server/admin/AggregationPropertyDefinition.java
index 809be53..a6f3551 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/admin/AggregationPropertyDefinition.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/admin/AggregationPropertyDefinition.java
@@ -604,13 +604,10 @@
}
// Make sure the reference managed object is enabled.
- if (needsEnabling) {
- if (!targetIsEnabledCondition.evaluate(context, ref)) {
- LocalizableMessage msg = ERR_CLIENT_REFINT_TARGET_DISABLED.get(ufn, name,
- getName());
- unacceptableReasons.add(msg);
- isAcceptable = false;
- }
+ if (needsEnabling
+ && !targetIsEnabledCondition.evaluate(context, ref)) {
+ unacceptableReasons.add(ERR_CLIENT_REFINT_TARGET_DISABLED.get(ufn, name, getName()));
+ isAcceptable = false;
}
}
return isAcceptable;
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.
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/admin/IntegerPropertyDefinition.java b/opendj-server-legacy/src/main/java/org/opends/server/admin/IntegerPropertyDefinition.java
index fb94adc..aeba6cb 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/admin/IntegerPropertyDefinition.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/admin/IntegerPropertyDefinition.java
@@ -301,10 +301,8 @@
ifNull(value);
// Make sure that we correctly encode negative values as "unlimited".
- if (allowUnlimited) {
- if (value < 0) {
- return UNLIMITED;
- }
+ if (allowUnlimited && value < 0) {
+ return UNLIMITED;
}
return value.toString();
@@ -314,14 +312,11 @@
* {@inheritDoc}
*/
@Override
- public Integer decodeValue(String value)
- throws PropertyException {
+ public Integer decodeValue(String value) throws PropertyException {
ifNull(value);
- if (allowUnlimited) {
- if (value.trim().equalsIgnoreCase(UNLIMITED)) {
- return -1;
- }
+ if (allowUnlimited && value.trim().equalsIgnoreCase(UNLIMITED)) {
+ return -1;
}
Integer i;
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/admin/PropertyDefinition.java b/opendj-server-legacy/src/main/java/org/opends/server/admin/PropertyDefinition.java
index 1af4afc..177d02e 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/admin/PropertyDefinition.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/admin/PropertyDefinition.java
@@ -420,12 +420,8 @@
return true;
} else if (o instanceof PropertyDefinition) {
PropertyDefinition<?> other = (PropertyDefinition<?>) o;
- if (propertyName.equals(other.propertyName)) {
- if (theClass.equals(other.theClass)) {
- return true;
- }
- }
- return false;
+ return propertyName.equals(other.propertyName)
+ && theClass.equals(other.theClass);
} else {
return false;
}
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/admin/SizePropertyDefinition.java b/opendj-server-legacy/src/main/java/org/opends/server/admin/SizePropertyDefinition.java
index 79e61dd..c956e4b 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/admin/SizePropertyDefinition.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/admin/SizePropertyDefinition.java
@@ -301,10 +301,8 @@
ifNull(value);
// Make sure that we correctly encode negative values as "unlimited".
- if (allowUnlimited) {
- if (value < 0) {
- return UNLIMITED;
- }
+ if (allowUnlimited && value < 0) {
+ return UNLIMITED;
}
// Encode the size value using the best-fit unit.
@@ -322,15 +320,12 @@
* {@inheritDoc}
*/
@Override
- public Long decodeValue(String value)
- throws PropertyException {
+ public Long decodeValue(String value) throws PropertyException {
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;
}
// Decode the value.
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/admin/client/ldap/LDAPDriver.java b/opendj-server-legacy/src/main/java/org/opends/server/admin/client/ldap/LDAPDriver.java
index 73a3082..663e6e3 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/admin/client/ldap/LDAPDriver.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/admin/client/ldap/LDAPDriver.java
@@ -22,7 +22,7 @@
*
*
* Copyright 2008-2009 Sun Microsystems, Inc.
- * Portions Copyright 2013-2014 ForgeRock AS.
+ * Portions Copyright 2013-2015 ForgeRock AS.
*/
package org.opends.server.admin.client.ldap;
@@ -640,13 +640,12 @@
newProperties.addProperty(pd, defaultValues, activeValues);
- if (activeValues.isEmpty() && defaultValues.isEmpty()
- && pd.hasOption(PropertyOption.MANDATORY)) {
- // The active values maybe empty because of a previous
- // exception.
- if (exception == null) {
- exception = PropertyException.propertyIsMandatoryException(pd);
- }
+ if (activeValues.isEmpty()
+ && defaultValues.isEmpty()
+ && pd.hasOption(PropertyOption.MANDATORY)
+ // The active values maybe empty because of a previous exception.
+ && exception == null) {
+ exception = PropertyException.propertyIsMandatoryException(pd);
}
if (exception != null) {
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/admin/client/spi/PropertySet.java b/opendj-server-legacy/src/main/java/org/opends/server/admin/client/spi/PropertySet.java
index 5e96a54..a470db0 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/admin/client/spi/PropertySet.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/admin/client/spi/PropertySet.java
@@ -332,11 +332,11 @@
throw PropertyException.propertyIsSingleValuedException(d);
}
- if (values.isEmpty() && d.hasOption(PropertyOption.MANDATORY)) {
- // But only if there are no default values.
- if (property.getDefaultValues().isEmpty()) {
- throw PropertyException.propertyIsMandatoryException(d);
- }
+ if (values.isEmpty()
+ && d.hasOption(PropertyOption.MANDATORY)
+ // But only if there are no default values.
+ && property.getDefaultValues().isEmpty()) {
+ throw PropertyException.propertyIsMandatoryException(d);
}
// Validate each value.
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/admin/doc/ConfigGuideGeneration.java b/opendj-server-legacy/src/main/java/org/opends/server/admin/doc/ConfigGuideGeneration.java
index 46bac69..08e7456 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/admin/doc/ConfigGuideGeneration.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/admin/doc/ConfigGuideGeneration.java
@@ -648,18 +648,17 @@
heading3("Relations To this Component");
}
- if (!mo.getReverseRelationDefinitions().isEmpty()) {
- if (!isReverseCompRelsEmpty) {
- paragraph(
- "The following components have a direct COMPOSITION relation TO " +
- mo.getUserFriendlyPluralName() + " :");
- for ( RelationDefinition rel : reverseCompRels) {
- beginList();
- AbstractManagedObjectDefinition childRel = rel.getParentDefinition();
- link(childRel.getUserFriendlyName().toString(), childRel.getName() +
- ".html");
- endList();
- }
+ if (!mo.getReverseRelationDefinitions().isEmpty()
+ && !isReverseCompRelsEmpty)
+ {
+ paragraph(
+ "The following components have a direct COMPOSITION relation TO " +
+ mo.getUserFriendlyPluralName() + " :");
+ for ( RelationDefinition rel : reverseCompRels) {
+ beginList();
+ AbstractManagedObjectDefinition childRel = rel.getParentDefinition();
+ link(childRel.getUserFriendlyName().toString(), childRel.getName() + ".html");
+ endList();
}
}
if (!isReverseAggregPropsEmpty) {
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/admin/server/ServerManagementContext.java b/opendj-server-legacy/src/main/java/org/opends/server/admin/server/ServerManagementContext.java
index c61abe1..3f201e9 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/admin/server/ServerManagementContext.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/admin/server/ServerManagementContext.java
@@ -874,18 +874,17 @@
pvalues.add(value);
}
- if (pvalues.isEmpty() && pd.hasOption(PropertyOption.MANDATORY)) {
- // The values maybe empty because of a previous exception.
- if (exception == null) {
- exception = PropertyException.propertyIsMandatoryException(pd);
- }
+ if (pvalues.isEmpty()
+ && pd.hasOption(PropertyOption.MANDATORY)
+ // The values maybe empty because of a previous exception.
+ && exception == null) {
+ exception = PropertyException.propertyIsMandatoryException(pd);
}
if (exception != null) {
throw exception;
- } else {
- return pvalues;
}
+ return pvalues;
}
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/api/AuthenticationPolicyState.java b/opendj-server-legacy/src/main/java/org/opends/server/api/AuthenticationPolicyState.java
index 7869abf..2034c61 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/api/AuthenticationPolicyState.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/api/AuthenticationPolicyState.java
@@ -216,15 +216,11 @@
}
}
- if (timeValue == -1)
- {
- if (logger.isTraceEnabled())
- {
- logger.trace("Returning -1 because attribute %s does not "
- + "exist in user entry %s", attributeType.getNameOrOID(), entry.getName());
- }
+ if (timeValue == -1 && logger.isTraceEnabled())
+ {
+ logger.trace("Returning -1 because attribute %s does not "
+ + "exist in user entry %s", attributeType.getNameOrOID(), entry.getName());
}
- // FIXME: else to be consistent...
return timeValue;
}
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/authorization/dseecompat/AciContainer.java b/opendj-server-legacy/src/main/java/org/opends/server/authorization/dseecompat/AciContainer.java
index f7e70f2..b9f2180 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/authorization/dseecompat/AciContainer.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/authorization/dseecompat/AciContainer.java
@@ -814,15 +814,13 @@
* - TLS is the security provider, and
* - The client provided a certificate.
*/
- if (authInfo.hasAuthenticationType(AuthenticationType.SASL) &&
- authInfo.hasSASLMechanism(saslMech)) {
-
- if(clientConnection instanceof LDAPClientConnection) {
- LDAPClientConnection lc =
- (LDAPClientConnection) clientConnection;
- Certificate[] certChain = lc.getClientCertificateChain();
- if(certChain.length != 0)
- matched = EnumEvalResult.TRUE;
+ if (authInfo.hasAuthenticationType(AuthenticationType.SASL)
+ && authInfo.hasSASLMechanism(saslMech)
+ && clientConnection instanceof LDAPClientConnection) {
+ LDAPClientConnection lc = (LDAPClientConnection) clientConnection;
+ Certificate[] certChain = lc.getClientCertificateChain();
+ if (certChain.length != 0) {
+ matched = EnumEvalResult.TRUE;
}
}
} else {
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/authorization/dseecompat/AciHandler.java b/opendj-server-legacy/src/main/java/org/opends/server/authorization/dseecompat/AciHandler.java
index b89d0f7..f1e5a94 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/authorization/dseecompat/AciHandler.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/authorization/dseecompat/AciHandler.java
@@ -22,7 +22,7 @@
*
*
* Copyright 2008-2010 Sun Microsystems, Inc.
- * Portions Copyright 2011-2014 ForgeRock AS
+ * Portions Copyright 2011-2015 ForgeRock AS
* Portions Copyright 2013 Manuel Gaupp
*/
package org.opends.server.authorization.dseecompat;
@@ -751,31 +751,29 @@
// type are being replaced or deleted. If only a subset is being
// deleted than this access check is skipped.
ModificationType modType = m.getModificationType();
- if ((modType == ModificationType.DELETE && modAttr.isEmpty())
- || modType == ModificationType.REPLACE
- || modType == ModificationType.INCREMENT)
+ if (((modType == ModificationType.DELETE && modAttr.isEmpty())
+ || modType == ModificationType.REPLACE
+ || modType == ModificationType.INCREMENT)
+ /*
+ * Check if we have rights to delete all values of an attribute
+ * type in the resource entry.
+ */
+ && resourceEntry.hasAttribute(modAttrType))
{
- /*
- * Check if we have rights to delete all values of an attribute
- * type in the resource entry.
- */
- if (resourceEntry.hasAttribute(modAttrType))
+ container.setCurrentAttributeType(modAttrType);
+ List<Attribute> attrList =
+ resourceEntry.getAttribute(modAttrType, modAttr.getOptions());
+ if (attrList != null)
{
- container.setCurrentAttributeType(modAttrType);
- List<Attribute> attrList =
- resourceEntry.getAttribute(modAttrType, modAttr.getOptions());
- if (attrList != null)
+ for (Attribute a : attrList)
{
- for (Attribute a : attrList)
+ for (ByteString v : a)
{
- for (ByteString v : a)
+ container.setCurrentAttributeValue(v);
+ container.setRights(ACI_WRITE_DELETE);
+ if (!skipAccessCheck && !accessAllowed(container))
{
- container.setCurrentAttributeValue(v);
- container.setRights(ACI_WRITE_DELETE);
- if (!skipAccessCheck && !accessAllowed(container))
- {
- return false;
- }
+ return false;
}
}
}
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/authorization/dseecompat/PatternIP.java b/opendj-server-legacy/src/main/java/org/opends/server/authorization/dseecompat/PatternIP.java
index a9e437d..37420a4 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/authorization/dseecompat/PatternIP.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/authorization/dseecompat/PatternIP.java
@@ -22,7 +22,7 @@
*
*
* Copyright 2008 Sun Microsystems, Inc.
- * Portions Copyright 2014 ForgeRock AS
+ * Portions Copyright 2014-2015 ForgeRock AS
*/
@@ -440,11 +440,10 @@
if(wildCardBitSet.cardinality() == IN4ADDRSZ)
return true;
for(int i=0;i <rulePrefixBytes.length; i++) {
- if(!wildCardBitSet.get(i)) {
- if((ruleAddrBytes[i] & rulePrefixBytes[i]) !=
- (addrBytes[i] & rulePrefixBytes[i]))
- return false;
- }
+ if (!wildCardBitSet.get(i)
+ && (ruleAddrBytes[i] & rulePrefixBytes[i]) !=
+ (addrBytes[i] & rulePrefixBytes[i]))
+ return false;
}
return true;
}
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/authorization/dseecompat/TargetAttr.java b/opendj-server-legacy/src/main/java/org/opends/server/authorization/dseecompat/TargetAttr.java
index d00b9a7..a04f4e7 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/authorization/dseecompat/TargetAttr.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/authorization/dseecompat/TargetAttr.java
@@ -26,12 +26,13 @@
*/
package org.opends.server.authorization.dseecompat;
-import org.forgerock.i18n.LocalizableMessage;
-
import static org.opends.messages.AccessControlMessages.*;
import static org.opends.server.authorization.dseecompat.Aci.*;
+
import java.util.HashSet;
import java.util.regex.Pattern;
+
+import org.forgerock.i18n.LocalizableMessage;
import org.opends.server.core.DirectoryServer;
import org.opends.server.types.AttributeType;
@@ -85,34 +86,24 @@
throws AciException {
this.operator = operator;
if (attrString != null) {
- if (Pattern.matches(ALL_USER_ATTRS_WILD_CARD, attrString) )
+ if (Pattern.matches(ALL_USER_ATTRS_WILD_CARD, attrString)) {
allUserAttributes = true ;
- else if (Pattern.matches(ALL_OP_ATTRS_WILD_CARD, attrString) )
+ } else if (Pattern.matches(ALL_OP_ATTRS_WILD_CARD, attrString)) {
allOpAttributes = true ;
- else {
- if (Pattern.matches(ZERO_OR_MORE_WHITESPACE, attrString)){
- allUserAttributes = false;
- allOpAttributes=false;
- } else {
- if (Pattern.matches(attrListRegex, attrString)) {
- // Remove the spaces in the attr string and
- // split the list.
- Pattern separatorPattern =
- Pattern.compile(LOGICAL_OR);
- attrString=
- attrString.replaceAll(ZERO_OR_MORE_WHITESPACE, "");
- String[] attributeArray=
- separatorPattern.split(attrString);
- //Add each element of array to appropriate HashSet
- //after conversion to AttributeType.
- arrayToAttributeTypes(attributeArray, attrString);
- } else {
- LocalizableMessage message =
- WARN_ACI_SYNTAX_INVALID_TARGETATTRKEYWORD_EXPRESSION.
- get(attrString);
- throw new AciException(message);
- }
- }
+ } else if (Pattern.matches(ZERO_OR_MORE_WHITESPACE, attrString)) {
+ allUserAttributes = false;
+ allOpAttributes = false;
+ } else if (Pattern.matches(attrListRegex, attrString)) {
+ // Remove the spaces in the attr string and
+ // split the list.
+ Pattern separatorPattern = Pattern.compile(LOGICAL_OR);
+ attrString = attrString.replaceAll(ZERO_OR_MORE_WHITESPACE, "");
+ String[] attributeArray = separatorPattern.split(attrString);
+ // Add each element of array to appropriate HashSet
+ // after conversion to AttributeType.
+ arrayToAttributeTypes(attributeArray, attrString);
+ } else {
+ throw new AciException(WARN_ACI_SYNTAX_INVALID_TARGETATTRKEYWORD_EXPRESSION.get(attrString));
}
}
}
@@ -131,8 +122,8 @@
*/
private void arrayToAttributeTypes(String[] attributeArray, String attrStr)
throws AciException {
- for (int i=0, n=attributeArray.length; i < n; i++) {
- String attribute=attributeArray[i].toLowerCase();
+ for (String attr : attributeArray) {
+ String attribute = attr.toLowerCase();
if(attribute.equals("*")) {
if(!allUserAttributes)
allUserAttributes=true;
@@ -266,30 +257,22 @@
* @param targetAttr The targetAttr to apply to the attribute type.
* @return True if the attribute type is applicable to the targetAttr.
*/
- private static
- boolean evalAttrType(AttributeType a, TargetAttr targetAttr) {
- boolean ret=false;
+ private static boolean evalAttrType(AttributeType a, TargetAttr targetAttr) {
+ final EnumTargetOperator op = targetAttr.getOperator();
if(a.isOperational()) {
- if(targetAttr.isAllOpAttributes() ||
- targetAttr.opAttributes.contains(a))
- ret=true;
- if(targetAttr.isAllOpAttributes() ||
- !targetAttr.opAttributes.isEmpty()) {
- if(targetAttr.getOperator().
- equals(EnumTargetOperator.NOT_EQUALITY))
- ret=!ret;
- }
+ return evalAttrType(a, targetAttr.isAllOpAttributes(), targetAttr.opAttributes, op);
} else {
- if(targetAttr.isAllUserAttributes() ||
- targetAttr.attributes.contains(a))
- ret=true;
- if(targetAttr.isAllUserAttributes() ||
- !targetAttr.attributes.isEmpty()) {
- if(targetAttr.getOperator().
- equals(EnumTargetOperator.NOT_EQUALITY))
- ret=!ret;
- }
+ return evalAttrType(a, targetAttr.isAllUserAttributes(), targetAttr.attributes, op);
}
- return ret;
}
+
+ private static boolean evalAttrType(AttributeType attrType, boolean allAttrs,
+ HashSet<AttributeType> attrs, EnumTargetOperator op) {
+ boolean ret = allAttrs || attrs.contains(attrType);
+ if (op.equals(EnumTargetOperator.NOT_EQUALITY))
+ {
+ return !ret;
+ }
+ return ret;
+ }
}
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/backends/jeb/BackupManager.java b/opendj-server-legacy/src/main/java/org/opends/server/backends/jeb/BackupManager.java
index ec74caa..cc8d01e 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/backends/jeb/BackupManager.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/backends/jeb/BackupManager.java
@@ -204,13 +204,10 @@
if (incremental)
{
- if (incrBaseID == null)
+ if (incrBaseID == null && backupDir.getLatestBackup() != null)
{
// The default is to use the latest backup as base.
- if (backupDir.getLatestBackup() != null)
- {
- incrBaseID = backupDir.getLatestBackup().getBackupID();
- }
+ incrBaseID = backupDir.getLatestBackup().getBackupID();
}
if (incrBaseID == null)
@@ -906,12 +903,10 @@
// See if we need to restore the file.
File file = new File(restoreDir, name);
OutputStream outputStream = null;
- if (includeFiles == null || includeFiles.contains(zipEntry.getName()))
+ if ((includeFiles == null || includeFiles.contains(zipEntry.getName()))
+ && !verifyOnly)
{
- if (!verifyOnly)
- {
- outputStream = new FileOutputStream(file);
- }
+ outputStream = new FileOutputStream(file);
}
if (outputStream != null || mac != null || digest != null)
@@ -972,14 +967,10 @@
zipStream.close();
// Check the hash.
- if (digest != null)
+ if (digest != null && !Arrays.equals(digest.digest(), hash))
{
- if (!Arrays.equals(digest.digest(), hash))
- {
- LocalizableMessage message = ERR_JEB_BACKUP_UNSIGNED_HASH_ERROR.get(backupID);
- throw new DirectoryException(DirectoryServer.getServerErrorResultCode(),
- message);
- }
+ LocalizableMessage message = ERR_JEB_BACKUP_UNSIGNED_HASH_ERROR.get(backupID);
+ throw new DirectoryException(DirectoryServer.getServerErrorResultCode(), message);
}
if (mac != null)
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/backends/jeb/PresenceIndexer.java b/opendj-server-legacy/src/main/java/org/opends/server/backends/jeb/PresenceIndexer.java
index fca1892..6b3c117 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/backends/jeb/PresenceIndexer.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/backends/jeb/PresenceIndexer.java
@@ -22,7 +22,7 @@
*
*
* Copyright 2006-2008 Sun Microsystems, Inc.
- * Portions Copyright 2014 ForgeRock AS
+ * Portions Copyright 2014-2015 ForgeRock AS
*/
package org.opends.server.backends.jeb;
@@ -73,12 +73,9 @@
public void indexEntry(Entry entry, Set<ByteString> keys, IndexingOptions options)
{
List<Attribute> attrList = entry.getAttribute(attributeType);
- if (attrList != null)
+ if (attrList != null && !attrList.isEmpty())
{
- if (!attrList.isEmpty())
- {
- keys.add(presenceKey);
- }
+ keys.add(presenceKey);
}
}
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/backends/pluggable/BackupManager.java b/opendj-server-legacy/src/main/java/org/opends/server/backends/pluggable/BackupManager.java
index 53455ec..251e940 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/backends/pluggable/BackupManager.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/backends/pluggable/BackupManager.java
@@ -205,13 +205,10 @@
if (incremental)
{
- if (incrBaseID == null)
+ if (incrBaseID == null && backupDir.getLatestBackup() != null)
{
// The default is to use the latest backup as base.
- if (backupDir.getLatestBackup() != null)
- {
- incrBaseID = backupDir.getLatestBackup().getBackupID();
- }
+ incrBaseID = backupDir.getLatestBackup().getBackupID();
}
if (incrBaseID == null)
@@ -897,12 +894,9 @@
// See if we need to restore the file.
File file = new File(restoreDir, name);
OutputStream outputStream = null;
- if (includeFiles == null || includeFiles.contains(zipEntry.getName()))
+ if ((includeFiles == null || includeFiles.contains(zipEntry.getName())) && !verifyOnly)
{
- if (!verifyOnly)
- {
- outputStream = new FileOutputStream(file);
- }
+ outputStream = new FileOutputStream(file);
}
if (outputStream != null || mac != null || digest != null)
@@ -963,14 +957,11 @@
zipStream.close();
// Check the hash.
- if (digest != null)
+ if (digest != null && !Arrays.equals(digest.digest(), hash))
{
- if (!Arrays.equals(digest.digest(), hash))
- {
- LocalizableMessage message = ERR_JEB_BACKUP_UNSIGNED_HASH_ERROR.get(backupID);
- throw new DirectoryException(DirectoryServer.getServerErrorResultCode(),
- message);
- }
+ LocalizableMessage message = ERR_JEB_BACKUP_UNSIGNED_HASH_ERROR.get(backupID);
+ throw new DirectoryException(DirectoryServer.getServerErrorResultCode(),
+ message);
}
if (mac != null)
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/backends/pluggable/Index.java b/opendj-server-legacy/src/main/java/org/opends/server/backends/pluggable/Index.java
index 44ef3c6..c9250fd 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/backends/pluggable/Index.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/backends/pluggable/Index.java
@@ -263,12 +263,11 @@
logIndexCorruptError(txn, key);
}
- if ((rebuildRunning || trusted) && isNotNullOrEmpty(addedIDs))
+ if ((rebuildRunning || trusted)
+ && isNotNullOrEmpty(addedIDs)
+ && !insert(txn, key, addedIDs.toByteString()))
{
- if(!insert(txn, key, addedIDs.toByteString()))
- {
- updateKeyWithRMW(txn, key, deletedIDs, addedIDs);
- }
+ updateKeyWithRMW(txn, key, deletedIDs, addedIDs);
}
}
}
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/backends/pluggable/PresenceIndexer.java b/opendj-server-legacy/src/main/java/org/opends/server/backends/pluggable/PresenceIndexer.java
index 0784518..4122c05 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/backends/pluggable/PresenceIndexer.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/backends/pluggable/PresenceIndexer.java
@@ -22,7 +22,7 @@
*
*
* Copyright 2006-2008 Sun Microsystems, Inc.
- * Portions Copyright 2014 ForgeRock AS
+ * Portions Copyright 2014-2015 ForgeRock AS
*/
package org.opends.server.backends.pluggable;
@@ -73,12 +73,9 @@
public void indexEntry(Entry entry, Set<ByteString> keys, IndexingOptions options)
{
List<Attribute> attrList = entry.getAttribute(attributeType);
- if (attrList != null)
+ if (attrList != null && !attrList.isEmpty())
{
- if (!attrList.isEmpty())
- {
- keys.add(presenceKey);
- }
+ keys.add(presenceKey);
}
}
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/backends/task/TaskScheduler.java b/opendj-server-legacy/src/main/java/org/opends/server/backends/task/TaskScheduler.java
index f9c5b70..a0dd01d 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/backends/task/TaskScheduler.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/backends/task/TaskScheduler.java
@@ -22,7 +22,7 @@
*
*
* Copyright 2006-2010 Sun Microsystems, Inc.
- * Portions Copyright 2013-2014 ForgeRock AS
+ * Portions Copyright 2013-2015 ForgeRock AS
*/
package org.opends.server.backends.task;
@@ -1675,12 +1675,9 @@
try
{
Entry e = t.getTaskEntry().duplicate(true);
- if (filter.matchesEntry(e))
+ if (filter.matchesEntry(e) && !searchOperation.returnEntry(e, null))
{
- if (! searchOperation.returnEntry(e, null))
- {
- return false;
- }
+ return false;
}
}
finally
@@ -1826,12 +1823,9 @@
try
{
Entry e = rt.getRecurringTaskEntry().duplicate(true);
- if (filter.matchesEntry(e))
+ if (filter.matchesEntry(e) && ! searchOperation.returnEntry(e, null))
{
- if (! searchOperation.returnEntry(e, null))
- {
- return false;
- }
+ return false;
}
}
finally
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/config/ConfigAttribute.java b/opendj-server-legacy/src/main/java/org/opends/server/config/ConfigAttribute.java
index 8a87b93..46d1344 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/config/ConfigAttribute.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/config/ConfigAttribute.java
@@ -550,13 +550,13 @@
// Make sure that the value limit will not be exceeded for a single-valued
// attribute.
- if (! isMultiValued)
+ if (!isMultiValued)
{
- if ((numValues > 1) || (hasPendingValues && (pendingValues.size() > 0)) ||
- ((! hasPendingValues) && (activeValues.size() > 0)))
+ if (numValues > 1
+ || (hasPendingValues && pendingValues.size() > 0)
+ || (!hasPendingValues && activeValues.size() > 0))
{
- LocalizableMessage message = ERR_CONFIG_ATTR_ADD_VALUES_IS_SINGLE_VALUED.get(name);
- throw new ConfigException(message);
+ throw new ConfigException(ERR_CONFIG_ATTR_ADD_VALUES_IS_SINGLE_VALUED.get(name));
}
}
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/controls/MatchedValuesFilter.java b/opendj-server-legacy/src/main/java/org/opends/server/controls/MatchedValuesFilter.java
index 0cb47a6..99a2b07 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/controls/MatchedValuesFilter.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/controls/MatchedValuesFilter.java
@@ -23,7 +23,7 @@
*
* Copyright 2006-2010 Sun Microsystems, Inc.
* Portions Copyright 2013-2014 Manuel Gaupp
- * Portions Copyright 2014 ForgeRock AS
+ * Portions Copyright 2014-2015 ForgeRock AS
*/
package org.opends.server.controls;
@@ -893,20 +893,14 @@
*/
public AttributeType getAttributeType()
{
- if (attributeType == null)
+ if (attributeType == null && rawAttributeType != null)
{
- if (rawAttributeType != null)
+ attributeType = DirectoryServer.getAttributeType(toLowerCase(rawAttributeType));
+ if (attributeType == null)
{
- attributeType =
- DirectoryServer.getAttributeType(toLowerCase(rawAttributeType));
- if (attributeType == null)
- {
- attributeType =
- DirectoryServer.getDefaultAttributeType(rawAttributeType);
- }
+ attributeType = DirectoryServer.getDefaultAttributeType(rawAttributeType);
}
}
-
return attributeType;
}
@@ -1015,15 +1009,10 @@
*/
public MatchingRule getMatchingRule()
{
- if (matchingRule == null)
+ if (matchingRule == null && matchingRuleID != null)
{
- if (matchingRuleID != null)
- {
- matchingRule =
- DirectoryServer.getMatchingRule(toLowerCase(matchingRuleID));
- }
+ matchingRule = DirectoryServer.getMatchingRule(toLowerCase(matchingRuleID));
}
-
return matchingRule;
}
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/core/EntryCacheConfigManager.java b/opendj-server-legacy/src/main/java/org/opends/server/core/EntryCacheConfigManager.java
index 978305e..34a43c3 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/core/EntryCacheConfigManager.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/core/EntryCacheConfigManager.java
@@ -186,13 +186,13 @@
configuration.addChangeListener(this);
// Check if there is another entry cache installed at the same level.
- if (!cacheOrderMap.isEmpty()) {
- if (cacheOrderMap.containsKey(configuration.getCacheLevel())) {
- // Log error and skip this cache.
- logger.error(ERR_CONFIG_ENTRYCACHE_CONFIG_LEVEL_NOT_ACCEPTABLE,
- configuration.dn(), configuration.getCacheLevel());
- continue;
- }
+ if (!cacheOrderMap.isEmpty()
+ && cacheOrderMap.containsKey(configuration.getCacheLevel()))
+ {
+ // Log error and skip this cache.
+ logger.error(ERR_CONFIG_ENTRYCACHE_CONFIG_LEVEL_NOT_ACCEPTABLE,
+ configuration.dn(), configuration.getCacheLevel());
+ continue;
}
// Initialize the entry cache.
@@ -374,13 +374,12 @@
{
// returned status -- all is fine by default
// Check if there is another entry cache installed at the same level.
- if (!cacheOrderMap.isEmpty()) {
- if (cacheOrderMap.containsKey(configuration.getCacheLevel())) {
- unacceptableReasons.add(
- ERR_CONFIG_ENTRYCACHE_CONFIG_LEVEL_NOT_ACCEPTABLE.get(
- configuration.dn(), configuration.getCacheLevel()));
- return false;
- }
+ if (!cacheOrderMap.isEmpty()
+ && cacheOrderMap.containsKey(configuration.getCacheLevel()))
+ {
+ unacceptableReasons.add(ERR_CONFIG_ENTRYCACHE_CONFIG_LEVEL_NOT_ACCEPTABLE.get(
+ configuration.dn(), configuration.getCacheLevel()));
+ return false;
}
if (configuration.isEnabled())
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/core/PasswordPolicyConfigManager.java b/opendj-server-legacy/src/main/java/org/opends/server/core/PasswordPolicyConfigManager.java
index 8451d13..e2db5c7 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/core/PasswordPolicyConfigManager.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/core/PasswordPolicyConfigManager.java
@@ -444,14 +444,10 @@
{
// If this is going to be the default password policy then check the type is
// correct.
- if (policyConfiguration.dn().equals(
- DirectoryServer.getDefaultPasswordPolicyDN()))
+ if (policyConfiguration.dn().equals(DirectoryServer.getDefaultPasswordPolicyDN())
+ && !(policyConfiguration instanceof PasswordPolicyCfg))
{
- if (!(policyConfiguration instanceof PasswordPolicyCfg))
- {
- LocalizableMessage msg = ERR_CONFIG_PWPOLICY_DEFAULT_POLICY_IS_WRONG_TYPE.get(policyConfiguration.dn());
- throw new ConfigException(msg);
- }
+ throw new ConfigException(ERR_CONFIG_PWPOLICY_DEFAULT_POLICY_IS_WRONG_TYPE.get(policyConfiguration.dn()));
}
String className = policyConfiguration.getJavaClass();
@@ -504,15 +500,11 @@
{
// If this is going to be the default password policy then check the type is
// correct.
- if (policyConfiguration.dn().equals(
- DirectoryServer.getDefaultPasswordPolicyDN()))
+ if (policyConfiguration.dn().equals(DirectoryServer.getDefaultPasswordPolicyDN())
+ && !(policyConfiguration instanceof PasswordPolicyCfg))
{
- if (!(policyConfiguration instanceof PasswordPolicyCfg))
- {
- LocalizableMessage msg = ERR_CONFIG_PWPOLICY_DEFAULT_POLICY_IS_WRONG_TYPE.get(policyConfiguration.dn());
- unacceptableReasons.add(msg);
- return false;
- }
+ unacceptableReasons.add(ERR_CONFIG_PWPOLICY_DEFAULT_POLICY_IS_WRONG_TYPE.get(policyConfiguration.dn()));
+ return false;
}
String className = policyConfiguration.getJavaClass();
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/extensions/AttributeValuePasswordValidator.java b/opendj-server-legacy/src/main/java/org/opends/server/extensions/AttributeValuePasswordValidator.java
index 790e05c..f4b5fcc 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/extensions/AttributeValuePasswordValidator.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/extensions/AttributeValuePasswordValidator.java
@@ -148,14 +148,12 @@
// Check to see if we should verify the whole password or the substrings.
int minSubstringLength = password.length();
- if (config.isCheckSubstrings())
+ if (config.isCheckSubstrings()
+ // We apply the minimal substring length only if the provided value
+ // is smaller then the actual password length
+ && config.getMinSubstringLength() < password.length())
{
- // We apply the minimal substring length only if the provided value
- // is smaller then the actual password length
- if (config.getMinSubstringLength() < password.length())
- {
- minSubstringLength = config.getMinSubstringLength();
- }
+ minSubstringLength = config.getMinSubstringLength();
}
// If we should check a specific set of attributes, then do that now.
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/extensions/DictionaryPasswordValidator.java b/opendj-server-legacy/src/main/java/org/opends/server/extensions/DictionaryPasswordValidator.java
index ee5bacc..3391e30 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/extensions/DictionaryPasswordValidator.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/extensions/DictionaryPasswordValidator.java
@@ -132,14 +132,12 @@
// the password which is the default behaviour ('check-substrings: false')
int minSubstringLength = password.length();
- if (config.isCheckSubstrings())
+ if (config.isCheckSubstrings()
+ // We apply the minimal substring length only if the provided value
+ // is smaller then the actual password length
+ && config.getMinSubstringLength() < password.length())
{
- // We apply the minimal substring length only if the provided value
- // is smaller then the actual password length
- if (config.getMinSubstringLength() < password.length())
- {
- minSubstringLength = config.getMinSubstringLength();
- }
+ minSubstringLength = config.getMinSubstringLength();
}
// Verify if the dictionary contains the word(s) in the password
@@ -152,15 +150,12 @@
// If the reverse password checking is enabled, then verify if the
// reverse value of the password is in the dictionary.
- if (config.isTestReversedPassword())
+ if (config.isTestReversedPassword()
+ && isDictionaryBased(
+ new StringBuilder(password).reverse().toString(), minSubstringLength))
{
- if (isDictionaryBased(
- new StringBuilder(password).reverse().toString(), minSubstringLength))
- {
- invalidReason.append(
- ERR_DICTIONARY_VALIDATOR_PASSWORD_IN_DICTIONARY.get());
- return false;
- }
+ invalidReason.append(ERR_DICTIONARY_VALIDATOR_PASSWORD_IN_DICTIONARY.get());
+ return false;
}
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/extensions/FileBasedTrustManagerProvider.java b/opendj-server-legacy/src/main/java/org/opends/server/extensions/FileBasedTrustManagerProvider.java
index 231e44f..0b4bd9d 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/extensions/FileBasedTrustManagerProvider.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/extensions/FileBasedTrustManagerProvider.java
@@ -380,28 +380,20 @@
// If there is a PIN property, then make sure the corresponding
// property is set.
String pinProp = configuration.getTrustStorePinProperty();
- if (pinProp != null)
+ if (pinProp != null && System.getProperty(pinProp) == null)
{
- if (System.getProperty(pinProp) == null)
- {
- LocalizableMessage message = ERR_FILE_TRUSTMANAGER_PIN_PROPERTY_NOT_SET.get(pinProp, cfgEntryDN);
- unacceptableReasons.add(message);
- configAcceptable = false;
- }
+ unacceptableReasons.add(ERR_FILE_TRUSTMANAGER_PIN_PROPERTY_NOT_SET.get(pinProp, cfgEntryDN));
+ configAcceptable = false;
}
// If there is a PIN environment variable, then make sure the corresponding
// environment variable is set.
String pinEnVar = configuration.getTrustStorePinEnvironmentVariable();
- if (pinEnVar != null)
+ if (pinEnVar != null && System.getenv(pinEnVar) == null)
{
- if (System.getenv(pinEnVar) == null)
- {
- LocalizableMessage message = ERR_FILE_TRUSTMANAGER_PIN_ENVAR_NOT_SET.get(pinEnVar, cfgEntryDN);
- unacceptableReasons.add(message);
- configAcceptable = false;
- }
+ unacceptableReasons.add(ERR_FILE_TRUSTMANAGER_PIN_ENVAR_NOT_SET.get(pinEnVar, cfgEntryDN));
+ configAcceptable = false;
}
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/extensions/IsMemberOfVirtualAttributeProvider.java b/opendj-server-legacy/src/main/java/org/opends/server/extensions/IsMemberOfVirtualAttributeProvider.java
index d8b39b0..38ffe88 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/extensions/IsMemberOfVirtualAttributeProvider.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/extensions/IsMemberOfVirtualAttributeProvider.java
@@ -310,18 +310,14 @@
try
{
Entry e = memberList.nextMemberEntry();
- if (e.matchesBaseAndScope(baseDN, scope) &&
- filter.matchesEntry(e))
+ if (e.matchesBaseAndScope(baseDN, scope)
+ && filter.matchesEntry(e)
+ // The set of returned DNs is only used for detecting set membership
+ // so it's ok to use the irreversible representation of the DN
+ && (returnedDNs == null || returnedDNs.add(e.getName().toIrreversibleNormalizedByteString()))
+ && !searchOperation.returnEntry(e, null))
{
- // The set of returned DNs is only used for detecting set membership
- // so it's ok to use the irreversible representation of the DN
- if (returnedDNs == null || returnedDNs.add(e.getName().toIrreversibleNormalizedByteString()))
- {
- if (!searchOperation.returnEntry(e, null))
- {
- return false;
- }
- }
+ return false;
}
}
catch (Exception e)
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/extensions/LDAPPassThroughAuthenticationPolicyFactory.java b/opendj-server-legacy/src/main/java/org/opends/server/extensions/LDAPPassThroughAuthenticationPolicyFactory.java
index 66079cf..2e7e980 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/extensions/LDAPPassThroughAuthenticationPolicyFactory.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/extensions/LDAPPassThroughAuthenticationPolicyFactory.java
@@ -2480,12 +2480,10 @@
// Ensure that the search bind password is defined somewhere.
if (cfg.getMappingPolicy() == MappingPolicy.MAPPED_SEARCH
&& cfg.getMappedSearchBindDN() != null
- && !cfg.getMappedSearchBindDN().isRootDN())
+ && !cfg.getMappedSearchBindDN().isRootDN()
+ && getMappedSearchBindPassword(cfg, unacceptableReasons) == null)
{
- if (getMappedSearchBindPassword(cfg, unacceptableReasons) == null)
- {
- configurationIsAcceptable = false;
- }
+ configurationIsAcceptable = false;
}
return configurationIsAcceptable;
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/extensions/PasswordModifyExtendedOperation.java b/opendj-server-legacy/src/main/java/org/opends/server/extensions/PasswordModifyExtendedOperation.java
index e93a7ab..136f29f 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/extensions/PasswordModifyExtendedOperation.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/extensions/PasswordModifyExtendedOperation.java
@@ -1268,13 +1268,11 @@
// If all of the changes were acceptable, then apply them.
- if (ccr.getResultCode() == ResultCode.SUCCESS)
+ if (ccr.getResultCode() == ResultCode.SUCCESS
+ && ! identityMapperDN.equals(mapperDN))
{
- if (! identityMapperDN.equals(mapperDN))
- {
- identityMapper = mapper;
- identityMapperDN = mapperDN;
- }
+ identityMapper = mapper;
+ identityMapperDN = mapperDN;
}
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/loggers/AbstractTextAccessLogPublisher.java b/opendj-server-legacy/src/main/java/org/opends/server/loggers/AbstractTextAccessLogPublisher.java
index 7634c39..8309997 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/loggers/AbstractTextAccessLogPublisher.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/loggers/AbstractTextAccessLogPublisher.java
@@ -344,12 +344,10 @@
private boolean filterRequest(final Operation operation)
{
// Check target DN.
- if (targetDNNotEqualTo.length > 0 || targetDNEqualTo.length > 0)
+ if ((targetDNNotEqualTo.length > 0 || targetDNEqualTo.length > 0)
+ && !filterRequestTargetDN(operation))
{
- if (!filterRequestTargetDN(operation))
- {
- return false;
- }
+ return false;
}
// TODO: check required controls.
@@ -485,21 +483,15 @@
final long etime = operation.getProcessingTime();
final Integer etimeGT = cfg.getResponseEtimeGreaterThan();
- if (etimeGT != null)
+ if (etimeGT != null && etime <= ((long) etimeGT))
{
- if (etime <= ((long) etimeGT))
- {
- return false;
- }
+ return false;
}
final Integer etimeLT = cfg.getResponseEtimeLessThan();
- if (etimeLT != null)
+ if (etimeLT != null && etime >= ((long) etimeLT))
{
- if (etime >= ((long) etimeLT))
- {
- return false;
- }
+ return false;
}
// Check search response fields.
@@ -538,21 +530,15 @@
final int nentries = searchOperation.getEntriesSent();
final Integer nentriesGT = cfg.getSearchResponseNentriesGreaterThan();
- if (nentriesGT != null)
+ if (nentriesGT != null && nentries <= nentriesGT)
{
- if (nentries <= nentriesGT)
- {
- return false;
- }
+ return false;
}
final Integer nentriesLT = cfg.getSearchResponseNentriesLessThan();
- if (nentriesLT != null)
+ if (nentriesLT != null && nentries >= nentriesLT)
{
- if (nentries >= nentriesLT)
- {
- return false;
- }
+ return false;
}
}
@@ -564,21 +550,17 @@
private boolean filterUser(final ClientConnection connection)
{
// Check user DN.
- if (userDNNotEqualTo.length > 0 || userDNEqualTo.length > 0)
+ if ((userDNNotEqualTo.length > 0 || userDNEqualTo.length > 0)
+ && !filterUserBindDN(connection))
{
- if (!filterUserBindDN(connection))
- {
- return false;
- }
+ return false;
}
// Check group membership.
- if (userIsNotMemberOf.length > 0 || userIsMemberOf.length > 0)
+ if ((userIsNotMemberOf.length > 0 || userIsMemberOf.length > 0)
+ && !filterUserIsMemberOf(connection))
{
- if (!filterUserIsMemberOf(connection))
- {
- return false;
- }
+ return false;
}
return true;
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/loggers/GZIPAction.java b/opendj-server-legacy/src/main/java/org/opends/server/loggers/GZIPAction.java
index 323b2e1..350cfc5 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/loggers/GZIPAction.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/loggers/GZIPAction.java
@@ -22,7 +22,7 @@
*
*
* Copyright 2006-2008 Sun Microsystems, Inc.
- * Portions Copyright 2014 ForgeRock AS
+ * Portions Copyright 2014-2015 ForgeRock AS
*/
package org.opends.server.loggers;
@@ -105,13 +105,10 @@
fis.close();
inputStreamOpen = false;
- if(deleteOriginal)
+ if(deleteOriginal && !originalFile.delete())
{
- if(!originalFile.delete())
- {
- System.err.println("Cannot delete original file:" + originalFile);
- return false;
- }
+ System.err.println("Cannot delete original file:" + originalFile);
+ return false;
}
return true;
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/loggers/ZIPAction.java b/opendj-server-legacy/src/main/java/org/opends/server/loggers/ZIPAction.java
index 156d18d..eb3e7c2 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/loggers/ZIPAction.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/loggers/ZIPAction.java
@@ -22,7 +22,7 @@
*
*
* Copyright 2006-2008 Sun Microsystems, Inc.
- * Portions Copyright 2014 ForgeRock AS.
+ * Portions Copyright 2014-2015 ForgeRock AS.
*/
package org.opends.server.loggers;
@@ -108,13 +108,10 @@
fis.close();
inputStreamOpen = false;
- if(deleteOriginal)
+ if(deleteOriginal && !originalFile.delete())
{
- if(!originalFile.delete())
- {
- System.err.println("Cannot delete original file:" + originalFile);
- return false;
- }
+ System.err.println("Cannot delete original file:" + originalFile);
+ return false;
}
return true;
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/plugins/SambaPasswordPlugin.java b/opendj-server-legacy/src/main/java/org/opends/server/plugins/SambaPasswordPlugin.java
index 9c33da8..a2afe03 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/plugins/SambaPasswordPlugin.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/plugins/SambaPasswordPlugin.java
@@ -692,17 +692,16 @@
*/
final DN authDN = extendedOperation.getAuthorizationDN();
final DN sambaAdminDN = config.getSambaAdministratorDN();
- if (sambaAdminDN != null && !sambaAdminDN.isRootDN())
+ if (sambaAdminDN != null
+ && !sambaAdminDN.isRootDN()
+ && authDN.equals(sambaAdminDN))
{
- if (authDN.equals(sambaAdminDN))
+ if (logger.isTraceEnabled())
{
- if (logger.isTraceEnabled())
- {
- logger.trace("This operation will be skipped because"
- + " it was performed by Samba admin user: " + sambaAdminDN);
- }
- return PluginResult.PostOperation.continueOperationProcessing();
+ logger.trace("This operation will be skipped because"
+ + " it was performed by Samba admin user: " + sambaAdminDN);
}
+ return PluginResult.PostOperation.continueOperationProcessing();
}
// Get the name of the entry and clear passwords from the operation
@@ -839,17 +838,16 @@
*/
final DN authDN = modifyOperation.getAuthorizationDN();
final DN sambaAdminDN = config.getSambaAdministratorDN();
- if (sambaAdminDN != null && !sambaAdminDN.isRootDN())
+ if (sambaAdminDN != null
+ && !sambaAdminDN.isRootDN()
+ && authDN.equals(sambaAdminDN))
{
- if (authDN.equals(sambaAdminDN))
+ if (logger.isTraceEnabled())
{
- if (logger.isTraceEnabled())
- {
- logger.trace("This operation will be skipped because"
- + " it was performed by Samba admin user: " + sambaAdminDN);
- }
- return PluginResult.PreOperation.continueOperationProcessing();
+ logger.trace("This operation will be skipped because"
+ + " it was performed by Samba admin user: " + sambaAdminDN);
}
+ return PluginResult.PreOperation.continueOperationProcessing();
}
/*
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/protocols/http/HTTPClientConnection.java b/opendj-server-legacy/src/main/java/org/opends/server/protocols/http/HTTPClientConnection.java
index 52308e6..786cb80 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/protocols/http/HTTPClientConnection.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/protocols/http/HTTPClientConnection.java
@@ -693,12 +693,11 @@
operationsPerformed.incrementAndGet();
final Operation operation = previousValue.operation;
- if (operation.getOperationType() == OperationType.ABANDON)
+ if (operation.getOperationType() == OperationType.ABANDON
+ && keepStats
+ && operation.getResultCode() == ResultCode.CANCELLED)
{
- if (keepStats && operation.getResultCode() == ResultCode.CANCELLED)
- {
- statTracker.updateAbandonedOperation();
- }
+ statTracker.updateAbandonedOperation();
}
}
return previousValue != null;
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/protocols/http/HTTPConnectionHandler.java b/opendj-server-legacy/src/main/java/org/opends/server/protocols/http/HTTPConnectionHandler.java
index f22ffce..beddd43 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/protocols/http/HTTPConnectionHandler.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/protocols/http/HTTPConnectionHandler.java
@@ -543,22 +543,18 @@
}
}
- if (config.isEnabled())
+ if (config.isEnabled() && config.isUseSSL())
{
- // Check that the SSL configuration is valid.
- if (config.isUseSSL())
+ try
{
- try
- {
- createSSLEngineConfigurator(config);
- }
- catch (DirectoryException e)
- {
- logger.traceException(e);
+ createSSLEngineConfigurator(config);
+ }
+ catch (DirectoryException e)
+ {
+ logger.traceException(e);
- unacceptableReasons.add(e.getMessageObject());
- return false;
- }
+ unacceptableReasons.add(e.getMessageObject());
+ return false;
}
}
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/protocols/ldap/LDAPClientConnection.java b/opendj-server-legacy/src/main/java/org/opends/server/protocols/ldap/LDAPClientConnection.java
index a2d977e..894b9eb 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/protocols/ldap/LDAPClientConnection.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/protocols/ldap/LDAPClientConnection.java
@@ -1293,12 +1293,11 @@
return false;
}
- if (operation.getOperationType() == OperationType.ABANDON)
+ if (operation.getOperationType() == OperationType.ABANDON
+ && keepStats
+ && operation.getResultCode() == ResultCode.CANCELLED)
{
- if (keepStats && operation.getResultCode() == ResultCode.CANCELLED)
- {
- statTracker.updateAbandonedOperation();
- }
+ statTracker.updateAbandonedOperation();
}
lastCompletionTime.set(TimeThread.getTime());
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/protocols/ldap/LDAPConnectionHandler.java b/opendj-server-legacy/src/main/java/org/opends/server/protocols/ldap/LDAPConnectionHandler.java
index 1a6c7c0..92cc9f5 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/protocols/ldap/LDAPConnectionHandler.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/protocols/ldap/LDAPConnectionHandler.java
@@ -320,12 +320,10 @@
// * num request handler
// Clear the stat tracker if LDAPv2 is being enabled.
- if (currentConfig.isAllowLDAPV2() != config.isAllowLDAPV2())
+ if (currentConfig.isAllowLDAPV2() != config.isAllowLDAPV2()
+ && config.isAllowLDAPV2())
{
- if (config.isAllowLDAPV2())
- {
- statTracker.clearStatistics();
- }
+ statTracker.clearStatistics();
}
// Apply the changes.
@@ -808,23 +806,20 @@
}
}
- if (config.isEnabled())
+ if (config.isEnabled()
+ // Check that the SSL configuration is valid.
+ && (config.isUseSSL() || config.isAllowStartTLS()))
{
- // Check that the SSL configuration is valid.
- if (config.isUseSSL() || config.isAllowStartTLS())
+ try
{
- try
- {
- SSLContext sslContext = createSSLContext(config);
- createSSLEngine(config, sslContext);
- }
- catch (DirectoryException e)
- {
- logger.traceException(e);
+ createSSLEngine(config, createSSLContext(config));
+ }
+ catch (DirectoryException e)
+ {
+ logger.traceException(e);
- unacceptableReasons.add(e.getMessageObject());
- return false;
- }
+ unacceptableReasons.add(e.getMessageObject());
+ return false;
}
}
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/replication/protocol/HeartbeatThread.java b/opendj-server-legacy/src/main/java/org/opends/server/replication/protocol/HeartbeatThread.java
index 351a15e..a9fcdb8 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/replication/protocol/HeartbeatThread.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/replication/protocol/HeartbeatThread.java
@@ -107,16 +107,14 @@
"was sent at %d", now, session.getLastPublishTime());
}
- if (now > session.getLastPublishTime() + heartbeatInterval)
+ if (now > session.getLastPublishTime() + heartbeatInterval
+ && !heartbeatsDisabled)
{
- if (!heartbeatsDisabled)
+ if (logger.isTraceEnabled())
{
- if (logger.isTraceEnabled())
- {
- logger.trace("Heartbeat sent at %d", now);
- }
- session.publish(heartbeatMessage);
+ logger.trace("Heartbeat sent at %d", now);
}
+ session.publish(heartbeatMessage);
}
long sleepTime = session.getLastPublishTime() + heartbeatInterval - now;
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/replication/protocol/ModifyCommonMsg.java b/opendj-server-legacy/src/main/java/org/opends/server/replication/protocol/ModifyCommonMsg.java
index 132c573..4504a58 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/replication/protocol/ModifyCommonMsg.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/replication/protocol/ModifyCommonMsg.java
@@ -22,7 +22,7 @@
*
*
* Copyright 2009-2010 Sun Microsystems, Inc.
- * Portions Copyright 2013-2014 ForgeRock AS
+ * Portions Copyright 2013-2015 ForgeRock AS
*/
package org.opends.server.replication.protocol;
@@ -131,14 +131,12 @@
{
Attribute attr = mod.getAttribute();
AttributeType type = attr.getAttributeType();
- if (type != null )
+ if (type != null
+ && AttributeUsage.DSA_OPERATION.equals(type.getUsage()) )
{
- if (AttributeUsage.DSA_OPERATION.equals(type.getUsage()))
- {
- // Attributes with a dsaOperation usage should not be synchronized.
- // skip them.
- continue;
- }
+ // Attributes with a dsaOperation usage should not be synchronized.
+ // skip them.
+ continue;
}
if (!EntryHistorical.isHistoricalAttribute(attr))
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/replication/server/SafeReadExpectedAcksInfo.java b/opendj-server-legacy/src/main/java/org/opends/server/replication/server/SafeReadExpectedAcksInfo.java
index 548c26d..8ea7ee3 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/replication/server/SafeReadExpectedAcksInfo.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/replication/server/SafeReadExpectedAcksInfo.java
@@ -223,13 +223,10 @@
for (int serverId : serverIds)
{
boolean ackReceived = expectedServersAckStatus.get(serverId);
- if (!ackReceived)
+ if (!ackReceived && !failedServers.contains(serverId))
{
- if (!failedServers.contains(serverId))
- {
- failedServers.add(serverId);
- serversInTimeout.add(serverId);
- }
+ failedServers.add(serverId);
+ serversInTimeout.add(serverId);
}
}
}
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/replication/server/changelog/file/Log.java b/opendj-server-legacy/src/main/java/org/opends/server/replication/server/changelog/file/Log.java
index d7e8db0..fcb4a3d 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/replication/server/changelog/file/Log.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/replication/server/changelog/file/Log.java
@@ -381,12 +381,9 @@
private void createRootDirIfNotExists() throws ChangelogException
{
- if (!logPath.exists())
+ if (!logPath.exists() && !logPath.mkdirs())
{
- if (!logPath.mkdirs())
- {
- throw new ChangelogException(ERR_CHANGELOG_UNABLE_TO_CREATE_LOG_DIRECTORY.get(logPath.getPath()));
- }
+ throw new ChangelogException(ERR_CHANGELOG_UNABLE_TO_CREATE_LOG_DIRECTORY.get(logPath.getPath()));
}
}
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/tasks/BackupTask.java b/opendj-server-legacy/src/main/java/org/opends/server/tasks/BackupTask.java
index 7768159..add3b6e 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/tasks/BackupTask.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/tasks/BackupTask.java
@@ -305,14 +305,11 @@
// If the incremental base ID was specified, then make sure it is an
// incremental backup.
- if (incrementalBase != null)
+ if (incrementalBase != null && ! incremental)
{
- if (! incremental)
- {
- logger.error(ERR_BACKUPDB_INCREMENTAL_BASE_REQUIRES_INCREMENTAL, ATTR_TASK_BACKUP_INCREMENTAL_BASE_ID,
- ATTR_TASK_BACKUP_INCREMENTAL);
- return false;
- }
+ logger.error(ERR_BACKUPDB_INCREMENTAL_BASE_REQUIRES_INCREMENTAL, ATTR_TASK_BACKUP_INCREMENTAL_BASE_ID,
+ ATTR_TASK_BACKUP_INCREMENTAL);
+ return false;
}
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/tools/BackUpDB.java b/opendj-server-legacy/src/main/java/org/opends/server/tools/BackUpDB.java
index 61b9cd6..e3b6b18 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/tools/BackUpDB.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/tools/BackUpDB.java
@@ -376,18 +376,15 @@
// If the incremental base ID was specified, then make sure it is an
// incremental backup.
- if (incrementalBaseID.isPresent())
+ if (incrementalBaseID.isPresent() && ! incremental.isPresent())
{
- if (! incremental.isPresent())
- {
- LocalizableMessage message =
- ERR_BACKUPDB_INCREMENTAL_BASE_REQUIRES_INCREMENTAL.get(
- incrementalBaseID.getLongIdentifier(),
- incremental.getLongIdentifier());
- err.println(wrapText(message, MAX_LINE_WIDTH));
- err.println(argParser.getUsage());
- return 1;
- }
+ LocalizableMessage message =
+ ERR_BACKUPDB_INCREMENTAL_BASE_REQUIRES_INCREMENTAL.get(
+ incrementalBaseID.getLongIdentifier(),
+ incremental.getLongIdentifier());
+ err.println(wrapText(message, MAX_LINE_WIDTH));
+ err.println(argParser.getUsage());
+ return 1;
}
// Encryption or signing requires the ADS backend be available for
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/tools/ConfigureDS.java b/opendj-server-legacy/src/main/java/org/opends/server/tools/ConfigureDS.java
index fc0c83b..d4dc5da 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/tools/ConfigureDS.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/tools/ConfigureDS.java
@@ -732,16 +732,12 @@
}
// Check that the keystore path values are valid.
- if (keyManagerPath.isPresent())
+ if (keyManagerPath.isPresent() && !keyManagerProviderDN.isPresent())
{
- if (!keyManagerProviderDN.isPresent())
- {
- LocalizableMessage message = ERR_CONFIGDS_KEYMANAGER_PROVIDER_DN_REQUIRED.get(
- keyManagerProviderDN.getLongIdentifier(),
- keyManagerPath.getLongIdentifier());
- err.println(wrapText(message, MAX_LINE_WIDTH));
- return 1;
- }
+ LocalizableMessage message = ERR_CONFIGDS_KEYMANAGER_PROVIDER_DN_REQUIRED.get(
+ keyManagerProviderDN.getLongIdentifier(), keyManagerPath.getLongIdentifier());
+ err.println(wrapText(message, MAX_LINE_WIDTH));
+ return 1;
}
// If one or more base DNs were specified, then update the config
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/tools/WaitForFileDelete.java b/opendj-server-legacy/src/main/java/org/opends/server/tools/WaitForFileDelete.java
index 4b1cde2..7badd6b 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/tools/WaitForFileDelete.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/tools/WaitForFileDelete.java
@@ -22,7 +22,7 @@
*
*
* Copyright 2006-2009 Sun Microsystems, Inc.
- * Portions Copyright 2013-2014 ForgeRock AS
+ * Portions Copyright 2013-2015 ForgeRock AS
*/
package org.opends.server.tools;
@@ -293,25 +293,22 @@
// and append data to it.
RandomAccessFile outputFile = null;
long outputFileOffset = 0L;
- if (logFile != null)
+ if (logFile != null && outputFilePath.isPresent())
{
- if (outputFilePath.isPresent())
+ try
{
- try
+ File f = new File(outputFilePath.getValue());
+ if (f.exists())
{
- File f = new File(outputFilePath.getValue());
- if (f.exists())
- {
- outputFile = new RandomAccessFile(f, "rw");
- outputFileOffset = outputFile.length();
- outputFile.seek(outputFileOffset);
- }
+ outputFile = new RandomAccessFile(f, "rw");
+ outputFileOffset = outputFile.length();
+ outputFile.seek(outputFileOffset);
}
- catch (Exception e)
- {
- println(WARN_WAIT4DEL_CANNOT_OPEN_OUTPUT_FILE.get(outputFilePath.getValue(), e));
- outputFile = null;
- }
+ }
+ catch (Exception e)
+ {
+ println(WARN_WAIT4DEL_CANNOT_OPEN_OUTPUT_FILE.get(outputFilePath.getValue(), e));
+ outputFile = null;
}
}
// Figure out when to stop waiting.
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/tools/makeldif/MakeLDIFInputStream.java b/opendj-server-legacy/src/main/java/org/opends/server/tools/makeldif/MakeLDIFInputStream.java
index cae3bf5..ac9667d 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/tools/makeldif/MakeLDIFInputStream.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/tools/makeldif/MakeLDIFInputStream.java
@@ -22,6 +22,7 @@
*
*
* Copyright 2006-2009 Sun Microsystems, Inc.
+ * Portions Copyright 2015 ForgeRock AS
*/
package org.opends.server.tools.makeldif;
@@ -148,13 +149,11 @@
throw ioException;
}
- if ((entryBytes == null) || (! entryBytes.hasRemaining()))
+ if ((entryBytes == null || !entryBytes.hasRemaining())
+ && !getNextEntry())
{
- if (! getNextEntry())
- {
- closed = true;
- return -1;
- }
+ closed = true;
+ return -1;
}
return (0xFF & entryBytes.get());
@@ -189,13 +188,11 @@
throw ioException;
}
- if ((entryBytes == null) || (! entryBytes.hasRemaining()))
+ if ((entryBytes == null || !entryBytes.hasRemaining())
+ && !getNextEntry())
{
- if (! getNextEntry())
- {
- closed = true;
- return -1;
- }
+ closed = true;
+ return -1;
}
int bytesRead = Math.min(len, entryBytes.remaining());
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/tools/makeldif/Template.java b/opendj-server-legacy/src/main/java/org/opends/server/tools/makeldif/Template.java
index 775f687..85e1fbc 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/tools/makeldif/Template.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/tools/makeldif/Template.java
@@ -180,12 +180,10 @@
for (TemplateLine l : templateLines)
{
- if (rdnAttrs.remove(l.getAttributeType()))
+ if (rdnAttrs.remove(l.getAttributeType())
+ && rdnAttrs.isEmpty())
{
- if (rdnAttrs.isEmpty())
- {
- break;
- }
+ break;
}
}
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/tools/upgrade/FileManager.java b/opendj-server-legacy/src/main/java/org/opends/server/tools/upgrade/FileManager.java
index 4d2f282..965279b 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/tools/upgrade/FileManager.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/tools/upgrade/FileManager.java
@@ -213,13 +213,10 @@
{
synchronized (target)
{
- if (target.exists())
+ if (target.exists() && !target.delete())
{
- if (!target.delete())
- {
- throw new IOException(INFO_ERROR_DELETING_FILE.get(
- UpgradeUtils.getPath(target)).toString());
- }
+ throw new IOException(INFO_ERROR_DELETING_FILE.get(
+ UpgradeUtils.getPath(target)).toString());
}
}
if (!fileToRename.renameTo(target))
@@ -384,16 +381,12 @@
{
fos.write(buf, 0, i);
}
- if (destination.exists())
+ if (destination.exists() && isUnix())
{
// TODO: set the file's permissions. This is made easier in
// Java 1.6 but until then use the TestUtilities methods
- if (isUnix())
- {
- final FilePermission permissions =
- getFileSystemPermissions(objectFile);
- FilePermission.setPermissions(destination, permissions);
- }
+ final FilePermission permissions = getFileSystemPermissions(objectFile);
+ FilePermission.setPermissions(destination, permissions);
}
}
catch (IOException e)
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/types/Schema.java b/opendj-server-legacy/src/main/java/org/opends/server/types/Schema.java
index 40a6493..29968db 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/types/Schema.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/types/Schema.java
@@ -22,7 +22,7 @@
*
*
* Copyright 2006-2010 Sun Microsystems, Inc.
- * Portions Copyright 2011-2014 ForgeRock AS
+ * Portions Copyright 2011-2015 ForgeRock AS
*/
package org.opends.server.types;
@@ -430,15 +430,12 @@
AttributeType superiorType)
{
List<AttributeType> subTypes = subordinateTypes.get(superiorType);
- if (subTypes != null)
+ if (subTypes != null && subTypes.remove(attributeType))
{
- if (subTypes.remove(attributeType))
+ AttributeType higherSuperior = superiorType.getSuperiorType();
+ if (higherSuperior != null)
{
- AttributeType higherSuperior = superiorType.getSuperiorType();
- if (higherSuperior != null)
- {
- deregisterSubordinateType(attributeType, higherSuperior);
- }
+ deregisterSubordinateType(attributeType, higherSuperior);
}
}
}
@@ -856,18 +853,11 @@
*/
synchronized (ldapSyntaxDescriptions)
{
- String oid = toLowerCase(
- syntax.getLdapSyntaxDescriptionSyntax().getOID());
- if (! overwriteExisting)
+ String oid = toLowerCase(syntax.getLdapSyntaxDescriptionSyntax().getOID());
+ if (! overwriteExisting && ldapSyntaxDescriptions.containsKey(oid))
{
- if (ldapSyntaxDescriptions.containsKey(oid))
- {
- LocalizableMessage message =
- ERR_SCHEMA_MODIFY_MULTIPLE_CONFLICTS_FOR_ADD_LDAP_SYNTAX.
- get(oid);
- throw new DirectoryException(
- ResultCode.CONSTRAINT_VIOLATION, message);
- }
+ throw new DirectoryException(ResultCode.CONSTRAINT_VIOLATION,
+ ERR_SCHEMA_MODIFY_MULTIPLE_CONFLICTS_FOR_ADD_LDAP_SYNTAX.get(oid));
}
ldapSyntaxDescriptions.put(oid, syntax);
@@ -875,8 +865,7 @@
//Register the attribute syntax with the schema. It will ensure
// syntax is available along with the other virtual values for
// ldapsyntaxes.
- registerSyntax(syntax.getLdapSyntaxDescriptionSyntax(),
- overwriteExisting);
+ registerSyntax(syntax.getLdapSyntaxDescriptionSyntax(), overwriteExisting);
}
}
@@ -1131,20 +1120,16 @@
{
MatchingRule matchingRule = matchingRuleUse.getMatchingRule();
- if (! overwriteExisting)
+ if (!overwriteExisting && matchingRuleUses.containsKey(matchingRule))
{
- if (matchingRuleUses.containsKey(matchingRule))
- {
- MatchingRuleUse conflictingUse =
- matchingRuleUses.get(matchingRule);
+ MatchingRuleUse conflictingUse = matchingRuleUses.get(matchingRule);
- LocalizableMessage message = ERR_SCHEMA_CONFLICTING_MATCHING_RULE_USE.
- get(matchingRuleUse.getNameOrOID(),
- matchingRule.getNameOrOID(),
- conflictingUse.getNameOrOID());
- throw new DirectoryException(
- ResultCode.CONSTRAINT_VIOLATION, message);
- }
+ LocalizableMessage message = ERR_SCHEMA_CONFLICTING_MATCHING_RULE_USE.
+ get(matchingRuleUse.getNameOrOID(),
+ matchingRule.getNameOrOID(),
+ conflictingUse.getNameOrOID());
+ throw new DirectoryException(
+ ResultCode.CONSTRAINT_VIOLATION, message);
}
matchingRuleUses.put(matchingRule, matchingRuleUse);
@@ -1246,20 +1231,17 @@
{
ObjectClass objectClass = ditContentRule.getStructuralClass();
- if (! overwriteExisting)
+ if (! overwriteExisting && ditContentRules.containsKey(objectClass))
{
- if (ditContentRules.containsKey(objectClass))
- {
- DITContentRule conflictingRule =
- ditContentRules.get(objectClass);
+ DITContentRule conflictingRule =
+ ditContentRules.get(objectClass);
- LocalizableMessage message = ERR_SCHEMA_CONFLICTING_DIT_CONTENT_RULE.
- get(ditContentRule.getNameOrOID(),
- objectClass.getNameOrOID(),
- conflictingRule.getNameOrOID());
- throw new DirectoryException(
- ResultCode.CONSTRAINT_VIOLATION, message);
- }
+ LocalizableMessage message = ERR_SCHEMA_CONFLICTING_DIT_CONTENT_RULE.
+ get(ditContentRule.getNameOrOID(),
+ objectClass.getNameOrOID(),
+ conflictingRule.getNameOrOID());
+ throw new DirectoryException(
+ ResultCode.CONSTRAINT_VIOLATION, message);
}
ditContentRules.put(objectClass, ditContentRule);
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/types/SearchFilter.java b/opendj-server-legacy/src/main/java/org/opends/server/types/SearchFilter.java
index 8676f86..079b9cb 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/types/SearchFilter.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/types/SearchFilter.java
@@ -22,7 +22,7 @@
*
*
* Copyright 2006-2009 Sun Microsystems, Inc.
- * Portions Copyright 2014 ForgeRock AS
+ * Portions Copyright 2014-2015 ForgeRock AS
* Portions Copyright 2013-2014 Manuel Gaupp
*/
package org.opends.server.types;
@@ -3259,20 +3259,17 @@
{
MatchingRuleUse mru =
DirectoryServer.getMatchingRuleUse(matchingRule);
- if (mru != null)
+ if (mru != null && !mru.appliesToAttribute(attributeType))
{
- if (! mru.appliesToAttribute(attributeType))
+ if (logger.isTraceEnabled())
{
- if (logger.isTraceEnabled())
- {
- logger.trace(
- "Attribute type %s is not allowed for use with " +
- "matching rule %s because of matching rule use " +
- "definition %s", attributeType.getNameOrOID(),
- matchingRule.getNameOrOID(), mru.getNameOrOID());
- }
- return ConditionResult.UNDEFINED;
+ logger.trace(
+ "Attribute type %s is not allowed for use with " +
+ "matching rule %s because of matching rule use " +
+ "definition %s", attributeType.getNameOrOID(),
+ matchingRule.getNameOrOID(), mru.getNameOrOID());
}
+ return ConditionResult.UNDEFINED;
}
}
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/util/LDIFReader.java b/opendj-server-legacy/src/main/java/org/opends/server/util/LDIFReader.java
index 5538b5b..62cb7e4 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/util/LDIFReader.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/util/LDIFReader.java
@@ -858,15 +858,14 @@
}
//The attribute is not being ignored so check for binary option.
- if(checkSchema && !attrType.getSyntax().isBEREncodingRequired())
+ if(checkSchema
+ && !attrType.getSyntax().isBEREncodingRequired()
+ && attribute.hasOption("binary"))
{
- if(attribute.hasOption("binary"))
- {
- LocalizableMessage message = ERR_LDIF_INVALID_ATTR_OPTION.get(
- entryDN, lastEntryLineNumber, attrName);
- logToRejectWriter(lines, message);
- throw new LDIFException(message, lastEntryLineNumber,true);
- }
+ LocalizableMessage message = ERR_LDIF_INVALID_ATTR_OPTION.get(
+ entryDN, lastEntryLineNumber, attrName);
+ logToRejectWriter(lines, message);
+ throw new LDIFException(message, lastEntryLineNumber,true);
}
if (checkSchema &&
(DirectoryServer.getSyntaxEnforcementPolicy() !=
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/util/StaticUtils.java b/opendj-server-legacy/src/main/java/org/opends/server/util/StaticUtils.java
index f9de846..93199cd 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/util/StaticUtils.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/util/StaticUtils.java
@@ -3480,14 +3480,11 @@
{
synchronized(target)
{
- if (target.exists())
+ if (target.exists() && !target.delete())
{
- if (!target.delete())
- {
- LocalizableMessage message =
- ERR_RENAMEFILE_CANNOT_DELETE_TARGET.get(target.getPath());
- throw new IOException(message.toString());
- }
+ LocalizableMessage message =
+ ERR_RENAMEFILE_CANNOT_DELETE_TARGET.get(target.getPath());
+ throw new IOException(message.toString());
}
}
if (!fileToRename.renameTo(target))
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/workflowelement/localbackend/LocalBackendBindOperation.java b/opendj-server-legacy/src/main/java/org/opends/server/workflowelement/localbackend/LocalBackendBindOperation.java
index 0aabf56..3fd5541 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/workflowelement/localbackend/LocalBackendBindOperation.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/workflowelement/localbackend/LocalBackendBindOperation.java
@@ -22,7 +22,7 @@
*
*
* Copyright 2008-2010 Sun Microsystems, Inc.
- * Portions Copyright 2011-2014 ForgeRock AS.
+ * Portions Copyright 2011-2015 ForgeRock AS.
*/
package org.opends.server.workflowelement.localbackend;
@@ -706,16 +706,13 @@
if (DirectoryServer.lockdownMode())
{
ResultCode resultCode = getResultCode();
- if (resultCode != ResultCode.SASL_BIND_IN_PROGRESS)
+ if (resultCode != ResultCode.SASL_BIND_IN_PROGRESS
+ && (resultCode != ResultCode.SUCCESS
+ || saslAuthUserEntry == null
+ || !ClientConnection.hasPrivilege(saslAuthUserEntry, Privilege.BYPASS_LOCKDOWN)))
{
- if ((resultCode != ResultCode.SUCCESS) ||
- (saslAuthUserEntry == null) ||
- (! ClientConnection.hasPrivilege(saslAuthUserEntry,
- Privilege.BYPASS_LOCKDOWN)))
- {
- throw new DirectoryException(ResultCode.INVALID_CREDENTIALS,
- ERR_BIND_REJECTED_LOCKDOWN_MODE.get());
- }
+ throw new DirectoryException(ResultCode.INVALID_CREDENTIALS,
+ ERR_BIND_REJECTED_LOCKDOWN_MODE.get());
}
}
@@ -796,14 +793,11 @@
PasswordPolicyState pwPolicyState =
(PasswordPolicyState) authPolicyState;
- if (saslHandler.isPasswordBased(saslMechanism))
+ if (saslHandler.isPasswordBased(saslMechanism)
+ && pwPolicyState.getAuthenticationPolicy().getLockoutFailureCount() > 0)
{
- if (pwPolicyState.getAuthenticationPolicy()
- .getLockoutFailureCount() > 0)
- {
- generateAccountStatusNotificationForLockedBindAccount(
- saslAuthUserEntry, pwPolicyState);
- }
+ generateAccountStatusNotificationForLockedBindAccount(
+ saslAuthUserEntry, pwPolicyState);
}
}
}
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/workflowelement/localbackend/LocalBackendCompareOperation.java b/opendj-server-legacy/src/main/java/org/opends/server/workflowelement/localbackend/LocalBackendCompareOperation.java
index 813514d..ffdef68 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/workflowelement/localbackend/LocalBackendCompareOperation.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/workflowelement/localbackend/LocalBackendCompareOperation.java
@@ -22,7 +22,7 @@
*
*
* Copyright 2008-2009 Sun Microsystems, Inc.
- * Portions Copyright 2011-2014 ForgeRock AS
+ * Portions Copyright 2011-2015 ForgeRock AS
*/
package org.opends.server.workflowelement.localbackend;
@@ -488,14 +488,12 @@
}
// NYI -- Add support for additional controls.
- else if (c.isCritical())
+ else if (c.isCritical()
+ && (backend == null || !backend.supportsControl(oid)))
{
- if ((backend == null) || (! backend.supportsControl(oid)))
- {
- throw new DirectoryException(
- ResultCode.UNAVAILABLE_CRITICAL_EXTENSION,
- ERR_COMPARE_UNSUPPORTED_CRITICAL_CONTROL.get(entryDN, oid));
- }
+ throw new DirectoryException(
+ ResultCode.UNAVAILABLE_CRITICAL_EXTENSION,
+ ERR_COMPARE_UNSUPPORTED_CRITICAL_CONTROL.get(entryDN, oid));
}
}
}
--
Gitblit v1.10.0