From b8c6b80da1cb6118167a934daa480eb381c59e0e Mon Sep 17 00:00:00 2001
From: Jean-Noel Rouvignac <jean-noel.rouvignac@forgerock.com>
Date: Wed, 08 Jul 2015 08:06:00 +0000
Subject: [PATCH] opendj-server-legacy maven module: Enabled "NeedBraces" checkstyle rule. This brings opendj-server-legacy's checkstyle rules closer to ForgeRock's checkstyle rules.
---
opendj-server-legacy/src/main/java/org/opends/server/authorization/dseecompat/ExtOp.java | 10
opendj-server-legacy/src/main/resources/org/forgerock/checkstyle/opends-checkstyle.xml | 18
opendj-server-legacy/src/main/java/org/opends/server/loggers/ParallelTextWriter.java | 5
opendj-server-legacy/src/test/java/org/opends/server/replication/plugin/DomainFakeCfg.java | 2
opendj-server-legacy/src/test/java/org/opends/server/controls/PersistentSearchControlTest.java | 5
opendj-server-legacy/src/main/java/org/opends/server/util/Crypt.java | 37 +
opendj-server-legacy/src/test/java/org/opends/server/replication/plugin/ReplicationServerFailoverTest.java | 4
opendj-server-legacy/src/main/java/org/opends/server/authorization/dseecompat/TargAttrFilterList.java | 4
opendj-server-legacy/src/main/java/org/opends/server/replication/server/SafeDataExpectedAcksInfo.java | 4
opendj-server-legacy/src/main/java/org/opends/server/util/Platform.java | 7
opendj-server-legacy/src/test/java/org/opends/quicksetup/util/FileManagerTest.java | 5
opendj-server-legacy/src/test/java/org/opends/server/replication/plugin/StateMachineTest.java | 35 +
opendj-server-legacy/src/main/java/org/opends/server/authorization/dseecompat/DayOfWeek.java | 4
opendj-server-legacy/src/main/java/org/opends/server/replication/protocol/ModifyCommonMsg.java | 2
opendj-server-legacy/src/main/java/org/opends/server/authorization/dseecompat/PatternIP.java | 44 +
opendj-server-legacy/src/main/java/org/opends/server/replication/service/ReplicationDomain.java | 62 +
opendj-server-legacy/src/test/java/org/opends/server/replication/ReplicationTestCase.java | 12
opendj-server-legacy/src/test/java/org/opends/server/replication/GenerationIdTest.java | 8
opendj-server-legacy/src/main/java/org/opends/server/api/AuthenticationPolicy.java | 5
opendj-server-legacy/src/test/java/org/opends/server/replication/DependencyTest.java | 8
opendj-server-legacy/src/test/java/org/opends/server/schema/BitStringSyntaxTest.java | 6
opendj-server-legacy/src/main/java/org/opends/server/replication/protocol/StopMsg.java | 12
opendj-server-legacy/src/test/java/org/opends/server/authorization/dseecompat/IPTestCase.java | 60 +
opendj-server-legacy/src/test/java/org/opends/server/replication/service/FakeReplicationDomain.java | 6
opendj-server-legacy/src/main/java/org/opends/server/authorization/dseecompat/ParentInheritance.java | 4
opendj-server-legacy/src/test/java/org/opends/server/authorization/dseecompat/AciTestCase.java | 34
opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/browser/NodeSearcherQueue.java | 15
opendj-server-legacy/src/test/java/org/opends/server/authorization/dseecompat/AciTests.java | 28
opendj-server-legacy/src/test/java/org/opends/server/replication/plugin/AssuredReplicationPluginTest.java | 26
opendj-server-legacy/src/dsml/org/opends/dsml/protocol/DSMLServlet.java | 2
opendj-server-legacy/src/main/java/org/opends/server/replication/plugin/LDAPReplicationDomain.java | 4
opendj-server-legacy/src/main/java/org/opends/server/protocols/jmx/DirectoryRMIServerSocketFactory.java | 6
opendj-server-legacy/src/main/java/org/opends/server/replication/plugin/FakeOperationComparator.java | 2
opendj-server-legacy/src/main/java/org/opends/server/replication/plugin/HistAttrModificationKey.java | 37 -
opendj-server-legacy/src/main/java/org/opends/server/tools/ManageTasks.java | 10
opendj-server-legacy/src/test/java/org/opends/server/replication/plugin/IsolationTest.java | 2
opendj-server-legacy/src/main/java/org/opends/server/replication/server/ServerReader.java | 7
opendj-server-legacy/src/test/java/org/opends/server/replication/plugin/TopologyViewTest.java | 10
opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/CustomObjectClassPanel.java | 25
opendj-server-legacy/src/test/java/org/opends/quicksetup/TestUtilities.java | 4
opendj-server-legacy/src/main/java/org/opends/server/extensions/DigestMD5SASLMechanismHandler.java | 13
opendj-server-legacy/src/main/java/org/opends/server/authorization/dseecompat/AciEffectiveRights.java | 49 +
opendj-server-legacy/src/main/java/org/opends/server/replication/plugin/AttrHistoricalMultiple.java | 4
opendj-server-legacy/src/main/java/org/opends/server/replication/server/DataServerHandler.java | 2
opendj-server-legacy/src/main/java/org/opends/server/authorization/dseecompat/TargetFilter.java | 4
opendj-server-legacy/src/main/java/org/opends/server/authorization/dseecompat/EnumRight.java | 44 +
opendj-server-legacy/src/main/java/org/opends/server/extensions/MD5PasswordStorageScheme.java | 6
opendj-server-legacy/src/test/java/org/opends/server/replication/server/MonitorTest.java | 4
opendj-server-legacy/src/main/java/org/opends/server/authorization/dseecompat/UserDN.java | 52 +
opendj-server-legacy/src/main/java/org/opends/server/util/CertificateManager.java | 6
opendj-server-legacy/src/main/java/org/opends/server/replication/server/SafeReadExpectedAcksInfo.java | 4
opendj-server-legacy/src/test/java/org/opends/server/core/RejectUnauthReqTests.java | 20
opendj-server-legacy/src/main/java/org/opends/server/replication/plugin/HistoricalAttributeValue.java | 2
opendj-server-legacy/src/main/java/org/opends/server/util/VersionCompatibilityIssue.java | 5
opendj-server-legacy/src/main/java/org/opends/server/protocols/http/CollectClientConnectionsFilter.java | 18
opendj-server-legacy/src/main/java/org/opends/server/authorization/dseecompat/SSF.java | 63 +-
opendj-server-legacy/src/main/java/org/opends/server/replication/server/ServerHandler.java | 2
opendj-server-legacy/src/main/java/org/opends/server/loggers/AsynchronousTextWriter.java | 5
opendj-server-legacy/src/test/java/org/opends/server/plugins/UniqueAttributePluginTestCase.java | 2
opendj-server-legacy/src/test/java/org/opends/server/replication/service/FakeStressReplicationDomain.java | 4
opendj-server-legacy/src/main/java/org/opends/server/controls/PagedResultsControl.java | 8
opendj-server-legacy/src/main/java/org/opends/server/authorization/dseecompat/TargetControl.java | 10
opendj-server-legacy/src/main/java/org/opends/server/extensions/TripleDESPasswordStorageScheme.java | 4
opendj-server-legacy/src/main/java/org/opends/server/loggers/DebugStackTraceFormatter.java | 4
opendj-server-legacy/src/main/java/org/opends/server/replication/service/ReplicationBroker.java | 24
opendj-server-legacy/src/test/java/org/opends/server/controls/PasswordControlTest.java | 6
opendj-server-legacy/src/test/java/org/opends/server/replication/plugin/GroupIdHandshakeTest.java | 16
opendj-server-legacy/src/main/java/org/opends/server/loggers/DebugMessageFormatter.java | 47 +
opendj-server-legacy/src/main/java/org/opends/server/tools/LDIFSearch.java | 6
opendj-server-legacy/src/main/java/org/opends/server/authorization/dseecompat/AciTargets.java | 60 +
opendj-server-legacy/src/main/java/org/opends/server/extensions/BlowfishPasswordStorageScheme.java | 4
opendj-server-legacy/src/test/java/org/opends/server/protocols/jmx/JmxConnectTest.java | 12
opendj-server-legacy/src/test/java/org/opends/server/authorization/dseecompat/ReferencesTestCase.java | 11
opendj-server-legacy/src/main/java/org/opends/server/authorization/dseecompat/TargAttrFilters.java | 32
opendj-server-legacy/src/test/java/org/opends/server/protocols/ldap/LDAPBinaryOptionTestCase.java | 8
opendj-server-legacy/src/main/java/org/opends/server/replication/server/LightweightServerHandler.java | 6
opendj-server-legacy/src/main/java/org/opends/server/types/HostPort.java | 10
opendj-server-legacy/src/test/java/org/opends/server/replication/server/AssuredReplicationServerTest.java | 6
opendj-server-legacy/src/main/java/org/opends/server/authorization/dseecompat/AciBody.java | 33
opendj-server-legacy/src/main/java/org/opends/server/replication/server/ReplicationServerHandler.java | 6
opendj-server-legacy/src/main/java/org/opends/server/extensions/CryptPasswordStorageScheme.java | 12
opendj-server-legacy/src/test/java/org/opends/server/extensions/SASLOverTLSTestCase.java | 8
opendj-server-legacy/src/main/java/org/opends/server/extensions/RC4PasswordStorageScheme.java | 4
opendj-server-legacy/src/main/java/org/opends/server/authorization/dseecompat/DNS.java | 20
opendj-server-legacy/src/main/java/org/opends/server/authorization/dseecompat/AciListenerManager.java | 4
opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/CustomAttributePanel.java | 19
opendj-server-legacy/src/main/java/org/opends/server/extensions/AESPasswordStorageScheme.java | 4
opendj-server-legacy/src/main/java/org/opends/server/authorization/dseecompat/TargetAttr.java | 16
opendj-server-legacy/src/main/java/org/opends/server/replication/plugin/AttrHistorical.java | 9
opendj-server-legacy/src/main/java/org/opends/server/replication/plugin/AttrHistoricalSingle.java | 4
opendj-server-legacy/src/test/java/org/opends/server/replication/InitOnLineTest.java | 24
opendj-server-legacy/src/main/java/org/opends/server/extensions/GSSAPISASLMechanismHandler.java | 9
opendj-server-legacy/src/test/java/org/opends/server/replication/server/changelog/file/BlockLogReaderWriterTest.java | 20
opendj-server-legacy/src/main/java/org/opends/server/authorization/dseecompat/Aci.java | 5
opendj-server-legacy/src/main/java/org/opends/server/controls/GetEffectiveRightsRequestControl.java | 4
opendj-server-legacy/src/main/java/org/opends/server/util/StaticUtils.java | 5
opendj-server-legacy/src/main/java/org/opends/server/extensions/SHA1PasswordStorageScheme.java | 6
opendj-server-legacy/src/test/java/org/opends/server/replication/service/ComputeBestServerTest.java | 12
opendj-server-legacy/src/test/java/org/opends/server/schema/AttributeSyntaxTest.java | 9
opendj-server-legacy/src/test/java/org/opends/server/replication/server/ReplicationServerTest.java | 14
opendj-server-legacy/src/main/java/org/opends/server/tools/tasks/TaskTool.java | 25
opendj-server-legacy/src/main/java/org/opends/server/tools/ImportLDIF.java | 5
opendj-server-legacy/src/test/java/org/opends/server/replication/StressTest.java | 9
opendj-server-legacy/src/main/java/org/opends/server/authorization/dseecompat/Permission.java | 6
opendj-server-legacy/src/main/java/org/opends/server/authorization/dseecompat/AciContainer.java | 55 +
opendj-server-legacy/src/test/java/org/opends/server/controls/MatchedValuesControlTest.java | 40 +
opendj-server-legacy/src/test/java/org/opends/server/protocols/ldap/LdapTestCase.java | 2
107 files changed, 1,170 insertions(+), 383 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 9976b3c..befd829 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
@@ -214,7 +214,9 @@
System.setProperty("mapAnyUriToUri", "true");
if(jaxbContext==null)
+ {
jaxbContext = JAXBContext.newInstance(PKG_NAME, getClass().getClassLoader());
+ }
// assign the DSMLv2 schema for validation
if(schema==null)
{
diff --git a/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/browser/NodeSearcherQueue.java b/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/browser/NodeSearcherQueue.java
index ec80343..3ab67f8 100644
--- a/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/browser/NodeSearcherQueue.java
+++ b/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/browser/NodeSearcherQueue.java
@@ -90,7 +90,10 @@
* @param nodeTask the task to be added.
*/
public synchronized void queue(AbstractNodeTask nodeTask) {
- if (nodeTask == null) throw new IllegalArgumentException("null argument");
+ if (nodeTask == null)
+ {
+ throw new IllegalArgumentException("null argument");
+ }
waitingQueue.add(nodeTask);
notify();
// System.out.println("Queued " + nodeTask + " in " + _name);
@@ -106,7 +109,10 @@
* @param node the node whose associated tasks must be cancelled.
*/
public synchronized void cancelForNode(BasicNode node) {
- if (node == null) throw new IllegalArgumentException("null argument");
+ if (node == null)
+ {
+ throw new IllegalArgumentException("null argument");
+ }
// Remove all the associated tasks from the waiting queue
for (int i = waitingQueue.size()-1; i >= 0; i--) {
AbstractNodeTask task = waitingQueue.get(i);
@@ -203,7 +209,10 @@
* @param task the task to be flushed.
*/
private synchronized void flush(AbstractNodeTask task) {
- if (task == null) throw new IllegalArgumentException("null argument");
+ if (task == null)
+ {
+ throw new IllegalArgumentException("null argument");
+ }
workingList.remove(task.getNode());
cancelList.remove(task.getNode());
notify();
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 d560c53..1bdcf91 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
@@ -1068,25 +1068,26 @@
private void checkEnableSaveChanges()
{
- if (ignoreChangeEvents) return;
- boolean changed;
+ if (!ignoreChangeEvents)
+ {
+ saveChanges.setEnabled(hasChanged());
+ }
+ }
+ private boolean hasChanged()
+ {
if (attribute != null)
{
try
{
- changed = !attribute.toString().equals(getNewAttribute().toString());
+ return !attribute.toString().equals(getNewAttribute().toString());
}
catch (Throwable t)
{
- changed = true;
+ return true;
}
}
- else
- {
- changed = false;
- }
- saveChanges.setEnabled(changed);
+ return false;
}
private String getAttributeName()
diff --git a/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/CustomObjectClassPanel.java b/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/CustomObjectClassPanel.java
index 3c278fc..29260e1 100644
--- a/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/CustomObjectClassPanel.java
+++ b/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/CustomObjectClassPanel.java
@@ -247,7 +247,10 @@
public void parentObjectClassesChanged(
SuperiorObjectClassesChangedEvent ev)
{
- if (ignoreChangeEvents) return;
+ if (ignoreChangeEvents)
+ {
+ return;
+ }
updateAttributesWithParent(true);
checkEnableSaveChanges();
if (ev.getNewObjectClasses().size() > 1)
@@ -903,26 +906,26 @@
private void checkEnableSaveChanges()
{
- if (ignoreChangeEvents) return;
- boolean changed;
+ if (!ignoreChangeEvents)
+ {
+ saveChanges.setEnabled(hasChanged());
+ }
+ }
+ private boolean hasChanged()
+ {
if (objectClass != null)
{
try
{
- changed = !objectClass.toString().equals(
- getNewObjectClass().toString());
+ return !objectClass.toString().equals(getNewObjectClass().toString());
}
catch (Throwable t)
{
- changed = true;
+ return true;
}
}
- else
- {
- changed = false;
- }
- saveChanges.setEnabled(changed);
+ return false;
}
private Set<String> getAliases()
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/api/AuthenticationPolicy.java b/opendj-server-legacy/src/main/java/org/opends/server/api/AuthenticationPolicy.java
index c1f600e..4cf7442 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/api/AuthenticationPolicy.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/api/AuthenticationPolicy.java
@@ -82,7 +82,10 @@
{
for (Attribute a : attrList)
{
- if (a.isEmpty()) continue;
+ if (a.isEmpty())
+ {
+ continue;
+ }
ByteString v = a.iterator().next();
DN subentryDN;
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/authorization/dseecompat/Aci.java b/opendj-server-legacy/src/main/java/org/opends/server/authorization/dseecompat/Aci.java
index b8c8e23..57df98d 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/authorization/dseecompat/Aci.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/authorization/dseecompat/Aci.java
@@ -583,7 +583,9 @@
int pos=0, length=oidStr.length();
char c;
if("*".equals(oidStr))
+ {
return;
+ }
boolean lastWasPeriod = false;
while ((pos < length) && ((c = oidStr.charAt(pos++)) != ' ')) {
if (c == '.') {
@@ -597,8 +599,9 @@
LocalizableMessage message =
WARN_ACI_SYNTAX_ILLEGAL_CHAR_IN_NUMERIC_OID.get(oidStr, c, pos-1);
throw new AciException(message);
- } else
+ } else {
lastWasPeriod = false;
+ }
}
}
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/authorization/dseecompat/AciBody.java b/opendj-server-legacy/src/main/java/org/opends/server/authorization/dseecompat/AciBody.java
index 5f214c2..60dd050 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/authorization/dseecompat/AciBody.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/authorization/dseecompat/AciBody.java
@@ -229,8 +229,9 @@
public boolean hasAccessType(EnumAccessType accessType) {
List<PermBindRulePair>pairs=getPermBindRulePairs();
for(PermBindRulePair p : pairs) {
- if(p.hasAccessType(accessType))
+ if(p.hasAccessType(accessType)) {
return true;
+ }
}
return false;
}
@@ -246,8 +247,9 @@
public boolean hasRights(int rights) {
List<PermBindRulePair>pairs=getPermBindRulePairs();
for(PermBindRulePair p : pairs) {
- if(p.hasRights(rights))
+ if(p.hasRights(rights)) {
return true;
+ }
}
return false;
}
@@ -291,10 +293,12 @@
List<PermBindRulePair>pairs=getPermBindRulePairs();
for(PermBindRulePair p : pairs) {
if(evalCtx.isDenyEval() &&
- (p.hasAccessType(EnumAccessType.ALLOW)))
+ (p.hasAccessType(EnumAccessType.ALLOW))) {
continue;
- if(!p.hasRights(getEvalRights(evalCtx)))
+ }
+ if(!p.hasRights(getEvalRights(evalCtx))) {
continue;
+ }
res=p.getBindRule().evaluate(evalCtx);
// The evaluation result could be FAIL. Stop processing and return
//FAIL. Maybe an internal search failed.
@@ -343,26 +347,27 @@
*/
private int getEvalRights(AciEvalContext evalCtx) {
if(evalCtx.hasRights(ACI_WRITE) &&
- evalCtx.hasRights(ACI_SELF))
+ evalCtx.hasRights(ACI_SELF)) {
return ACI_SELF;
- else if(evalCtx.hasRights(ACI_COMPARE))
+ } else if(evalCtx.hasRights(ACI_COMPARE)) {
return ACI_COMPARE;
- else if(evalCtx.hasRights(ACI_SEARCH))
+ } else if(evalCtx.hasRights(ACI_SEARCH)) {
return ACI_SEARCH;
- else if(evalCtx.hasRights(ACI_READ))
+ } else if(evalCtx.hasRights(ACI_READ)) {
return ACI_READ;
- else if(evalCtx.hasRights(ACI_DELETE))
+ } else if(evalCtx.hasRights(ACI_DELETE)) {
return ACI_DELETE;
- else if(evalCtx.hasRights(ACI_ADD))
+ } else if(evalCtx.hasRights(ACI_ADD)) {
return ACI_ADD;
- else if(evalCtx.hasRights(ACI_WRITE))
+ } else if(evalCtx.hasRights(ACI_WRITE)) {
return ACI_WRITE;
- else if(evalCtx.hasRights(ACI_PROXY))
+ } else if(evalCtx.hasRights(ACI_PROXY)) {
return ACI_PROXY;
- else if(evalCtx.hasRights(ACI_IMPORT))
+ } else if(evalCtx.hasRights(ACI_IMPORT)) {
return ACI_IMPORT;
- else if(evalCtx.hasRights(ACI_EXPORT))
+ } else if(evalCtx.hasRights(ACI_EXPORT)) {
return ACI_EXPORT;
+ }
return ACI_NULL;
}
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 c81cf7b..09bd8a6 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
@@ -256,9 +256,11 @@
&& operation instanceof SearchOperation)
{
hasGetEffectiveRightsControl = true;
- if (getEffectiveRightsControl.getAuthzDN() == null)
+ if (getEffectiveRightsControl.getAuthzDN() == null) {
this.authzid = getClientDN();
- else this.authzid = getEffectiveRightsControl.getAuthzDN();
+ } else {
+ this.authzid = getEffectiveRightsControl.getAuthzDN();
+ }
this.specificAttrs = getEffectiveRightsControl.getAttributes();
}
@@ -268,13 +270,17 @@
String allUserAttrs=
(String)operation.getAttachment(ALL_USER_ATTRS_MATCHED);
if(allUserAttrs != null)
+ {
evalAllAttributes |= ACI_USER_ATTR_STAR_MATCHED;
+ }
//If an ACI evaluated because of an Targetattr="+", then the
//AciHandler.maySend method signaled this via adding this attachment
//string.
String allOpAttrs=(String)operation.getAttachment(ALL_OP_ATTRS_MATCHED);
if(allOpAttrs != null)
+ {
evalAllAttributes |= ACI_OP_ATTR_PLUS_MATCHED;
+ }
}
//Reference the current authorization entry, so it can be put back
@@ -433,9 +439,10 @@
/** {@inheritDoc} */
@Override
public String getDecidingAciName() {
- if(this.decidingAci != null)
- return this.decidingAci.getName();
- else return null;
+ if(this.decidingAci != null) {
+ return this.decidingAci.getName();
+ }
+ return null;
}
/** {@inheritDoc} */
@@ -575,9 +582,13 @@
@Override
public DN getClientDN() {
if(this.useAuthzid)
+ {
return this.authzid;
+ }
else if (this.authorizationEntry != null)
+ {
return this.authorizationEntry.getName();
+ }
return DN.rootDN();
}
@@ -748,26 +759,46 @@
@Override
public String rightToString() {
if(hasRights(ACI_SEARCH))
+ {
return "search";
+ }
else if(hasRights(ACI_COMPARE))
+ {
return "compare";
+ }
else if(hasRights(ACI_READ))
+ {
return "read";
+ }
else if(hasRights(ACI_DELETE))
+ {
return "delete";
+ }
else if(hasRights(ACI_ADD))
+ {
return "add";
+ }
else if(hasRights(ACI_WRITE))
+ {
return "write";
+ }
else if(hasRights(ACI_PROXY))
+ {
return "proxy";
+ }
else if(hasRights(ACI_IMPORT))
+ {
return "import";
+ }
else if(hasRights(ACI_EXPORT))
+ {
return "export";
+ }
else if(hasRights(ACI_WRITE) &&
hasRights(ACI_SELF))
+ {
return "selfwrite";
+ }
return null;
}
@@ -778,8 +809,11 @@
if(v == ACI_FOUND_USER_ATTR_RULE) {
evalAllAttributes |= ACI_FOUND_USER_ATTR_RULE;
evalAllAttributes &= ~ACI_USER_ATTR_STAR_MATCHED;
- } else
+ }
+ else
+ {
evalAllAttributes |= ACI_USER_ATTR_STAR_MATCHED;
+ }
}
}
@@ -790,8 +824,11 @@
if(v == ACI_FOUND_OP_ATTR_RULE) {
evalAllAttributes |= ACI_FOUND_OP_ATTR_RULE;
evalAllAttributes &= ~ACI_OP_ATTR_PLUS_MATCHED;
- } else
+ }
+ else
+ {
evalAllAttributes |= ACI_OP_ATTR_PLUS_MATCHED;
+ }
}
}
@@ -836,9 +873,13 @@
@Override
public void clearEvalAttributes(int v) {
if(v == 0)
+ {
evalAllAttributes=0;
+ }
else
+ {
evalAllAttributes &= ~v;
+ }
}
/** {@inheritDoc} */
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/authorization/dseecompat/AciEffectiveRights.java b/opendj-server-legacy/src/main/java/org/opends/server/authorization/dseecompat/AciEffectiveRights.java
index 5d831af..13b4a67 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/authorization/dseecompat/AciEffectiveRights.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/authorization/dseecompat/AciEffectiveRights.java
@@ -277,7 +277,9 @@
AttributeType attrType = DirectoryServer.getAttributeType(a
.toLowerCase());
if (attrType == null)
+ {
attrType = DirectoryServer.getDefaultAttributeType(a.toLowerCase());
+ }
nonRightsAttrs.add(attrType);
}
}
@@ -352,9 +354,10 @@
final Entry retEntry, List<AttributeType> attrList,
boolean skipCheck, boolean specificAttr)
{
-
- // The attribute list might be null.
- if (attrList == null) return;
+ if (attrList == null)
+ {
+ return;
+ }
for(AttributeType a : attrList) {
StringBuilder evalInfo=new StringBuilder();
@@ -419,7 +422,9 @@
//in both the search and the specific attribute part of the control.
//Only try to add the attribute type if it already hasn't been added.
if(!retEntry.hasAttribute(attributeType))
- retEntry.addAttribute(attr,null);
+ {
+ retEntry.addAttribute(attr,null);
+ }
}
}
container.setCurrentAttributeValue(null);
@@ -585,13 +590,15 @@
//Check if read right check, if so do accessAllowedEntry.
if(container.hasRights(ACI_READ) &&
container.getCurrentAttributeType() == null)
+ {
ret=handler.accessAllowedEntry(container);
+ }
else
+ {
ret=handler.accessAllowed(container);
- if(ret)
- resString.append(rightStr).append(":1");
- else
- resString.append(rightStr).append(":0");
+ }
+
+ resString.append(rightStr).append(ret ? ":1" : ":0");
}
return resString.toString();
}
@@ -655,7 +662,9 @@
// The attribute type might have already been added, probably
// not but it is possible.
if(!retEntry.hasAttribute(attributeType))
- retEntry.addAttribute(attr,null);
+ {
+ retEntry.addAttribute(attr,null);
+ }
}
}
@@ -727,7 +736,9 @@
//targattrfilters ACI name only if a deny targattrfilters ACI
//was not seen. It could remove the allow.
if(!evalCtx.hasTargAttrFiltersMatchOp(ACL_TARGATTR_DENY_MATCH))
+ {
evalCtx.setTargAttrFiltersAciName(null);
+ }
} else {
//The evaluation returned false. If the reason was an
//explicit deny evaluation by a non-targattrfilters ACI, clear
@@ -737,22 +748,32 @@
//ACI that might have granted access the deny stands, else there is
//a targattrfilters ACI that might grant access.
if(evalCtx.getEvalReason() == EnumEvalReason.EVALUATED_DENY_ACI)
+ {
evalCtx.setTargAttrFiltersAciName(null);
+ }
else if(!evalCtx.hasTargAttrFiltersMatchOp(ACL_TARGATTR_ALLOW_MATCH))
+ {
evalCtx.setTargAttrFiltersAciName(null);
+ }
}
}
//Actually build the string.
String user=anonymous;
if(!evalCtx.getClientDN().isRootDN())
+ {
user=evalCtx.getClientDN().toString();
+ }
String right=evalCtx.rightToString();
AttributeType aType=evalCtx.getCurrentAttributeType();
String attrStr="NULL";
if(aType != null)
+ {
attrStr=aType.getPrimaryName();
+ }
if(evalCtx.getTargAttrFiltersAciName() != null)
+ {
decideAci.append(", access depends on attr value");
+ }
return String.format(summaryFormatStr, srcStr, accessStatus,
right,evalCtx.getResourceDN().toString(),attrStr, user,
accessReason, decideAci.toString());
@@ -761,15 +782,25 @@
private static String getEvalReason(EnumEvalReason evalReason)
{
if (evalReason == EnumEvalReason.EVALUATED_ALLOW_ACI)
+ {
return EVALUATED_ALLOW;
+ }
else if (evalReason == EnumEvalReason.EVALUATED_DENY_ACI)
+ {
return EVALUATED_DENY;
+ }
else if (evalReason == EnumEvalReason.NO_ALLOW_ACIS)
+ {
return NO_ALLOWS;
+ }
else if (evalReason == EnumEvalReason.NO_MATCHED_ALLOWS_ACIS)
+ {
return NO_ALLOWS_MATCHED;
+ }
else if (evalReason == EnumEvalReason.SKIP_ACI)
+ {
return SKIP_ACI;
+ }
return "";
}
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/authorization/dseecompat/AciListenerManager.java b/opendj-server-legacy/src/main/java/org/opends/server/authorization/dseecompat/AciListenerManager.java
index 0cef096..dc86d77 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/authorization/dseecompat/AciListenerManager.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/authorization/dseecompat/AciListenerManager.java
@@ -446,7 +446,9 @@
{
int validAcis = aciList.addAci(internalSearch.getSearchEntries(), failedACIMsgs);
if (!failedACIMsgs.isEmpty())
+ {
logMsgsSetLockDownMode(failedACIMsgs);
+ }
logger.debug(INFO_ACI_ADD_LIST_ACIS, validAcis, baseDN);
}
}
@@ -530,7 +532,9 @@
logger.warn(WARN_ACI_SERVER_DECODE_FAILED, msg);
}
if (!inLockDownMode)
+ {
setLockDownMode();
+ }
}
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/authorization/dseecompat/AciTargets.java b/opendj-server-legacy/src/main/java/org/opends/server/authorization/dseecompat/AciTargets.java
index 001e366..f2b86ee 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/authorization/dseecompat/AciTargets.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/authorization/dseecompat/AciTargets.java
@@ -398,13 +398,21 @@
private static SearchScope createScope(String expression)
throws AciException {
if(expression.equalsIgnoreCase("base"))
- return SearchScope.BASE_OBJECT;
+ {
+ return SearchScope.BASE_OBJECT;
+ }
else if(expression.equalsIgnoreCase("onelevel"))
- return SearchScope.SINGLE_LEVEL;
+ {
+ return SearchScope.SINGLE_LEVEL;
+ }
else if(expression.equalsIgnoreCase("subtree"))
- return SearchScope.WHOLE_SUBTREE;
+ {
+ return SearchScope.WHOLE_SUBTREE;
+ }
else if(expression.equalsIgnoreCase("subordinate"))
- return SearchScope.SUBORDINATES;
+ {
+ return SearchScope.SUBORDINATES;
+ }
else {
LocalizableMessage message =
WARN_ACI_SYNTAX_INVALID_TARGETSCOPE_EXPRESSION.get(expression);
@@ -472,12 +480,16 @@
targAttrFilters.hasMask(TARGATTRFILTERS_ADD)) ||
(matchCtx.hasRights(ACI_DELETE) &&
targAttrFilters.hasMask(TARGATTRFILTERS_DELETE)))
- ret=targAttrFilters.isApplicableAddDel(matchCtx);
+ {
+ ret=targAttrFilters.isApplicableAddDel(matchCtx);
+ }
else if((matchCtx.hasRights(ACI_WRITE_ADD) &&
targAttrFilters.hasMask(TARGATTRFILTERS_ADD)) ||
(matchCtx.hasRights(ACI_WRITE_DELETE) &&
targAttrFilters.hasMask(TARGATTRFILTERS_DELETE)))
- ret=targAttrFilters.isApplicableMod(matchCtx, aci);
+ {
+ ret=targAttrFilters.isApplicableMod(matchCtx, aci);
+ }
}
return ret;
}
@@ -519,7 +531,9 @@
}
if (isFirstAttr && targetAttr == null
&& aci.getTargets().getTargAttrFilters() == null)
- targetMatchCtx.setEntryTestRule(true);
+ {
+ targetMatchCtx.setEntryTestRule(true);
+ }
}
return ret;
}
@@ -583,13 +597,17 @@
(!targets.getTarget().isPattern())) {
EnumTargetOperator op=targets.getTarget().getOperator();
if(op != EnumTargetOperator.NOT_EQUALITY)
- targetDN=targets.getTarget().getDN();
+ {
+ targetDN=targets.getTarget().getDN();
+ }
}
//Check if the scope is correct.
switch(targets.getTargetScope().asEnum()) {
case BASE_OBJECT:
if(!targetDN.equals(entryDN))
- return false;
+ {
+ return false;
+ }
break;
case SINGLE_LEVEL:
/*
@@ -599,11 +617,15 @@
* Non-standard interpretation of onelevel in ACI targetScope.
*/
if(!targetDN.equals(entryDN.parent()))
- return false;
+ {
+ return false;
+ }
break;
case WHOLE_SUBTREE:
if(!entryDN.isDescendantOf(targetDN))
- return false;
+ {
+ return false;
+ }
break;
case SUBORDINATES:
if ((entryDN.size() <= targetDN.size()) ||
@@ -625,7 +647,9 @@
if(op == EnumTargetOperator.NOT_EQUALITY) {
DN tmpDN=targets.getTarget().getDN();
if(entryDN.isDescendantOf(tmpDN))
- return false;
+ {
+ return false;
+ }
}
}
/*
@@ -638,7 +662,9 @@
final boolean ret = targets.getTarget().matchesPattern(entryDN);
EnumTargetOperator op=targets.getTarget().getOperator();
if(op == EnumTargetOperator.NOT_EQUALITY)
- return !ret;
+ {
+ return !ret;
+ }
return ret;
}
return true;
@@ -676,14 +702,22 @@
*/
if(ret && targetAttr.isAllUserAttributes() &&
!ctx.hasEvalUserAttributes())
+ {
ctx.setEvalUserAttributes(ACI_USER_ATTR_STAR_MATCHED);
+ }
else
+ {
ctx.setEvalUserAttributes(ACI_FOUND_USER_ATTR_RULE);
+ }
if(ret && targetAttr.isAllOpAttributes() &&
!ctx.hasEvalOpAttributes())
+ {
ctx.setEvalOpAttributes(ACI_OP_ATTR_PLUS_MATCHED);
+ }
else
+ {
ctx.setEvalOpAttributes(ACI_FOUND_OP_ATTR_RULE);
+ }
}
}
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/authorization/dseecompat/DNS.java b/opendj-server-legacy/src/main/java/org/opends/server/authorization/dseecompat/DNS.java
index 7b63ce4..d77bd0e 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/authorization/dseecompat/DNS.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/authorization/dseecompat/DNS.java
@@ -183,21 +183,25 @@
boolean evalHostName(String[] remoteHostName, String[] pat) {
boolean wildCard=pat[0].equals("*");
//Check if there is a single wild-card.
- if(pat.length == 1 && wildCard)
+ if(pat.length == 1 && wildCard) {
return true;
+ }
int remoteHnIndex=remoteHostName.length-pat.length;
- if(remoteHnIndex < 0)
+ if(remoteHnIndex < 0) {
return false;
+ }
int patternIndex=0;
- if(!wildCard)
- remoteHnIndex=0;
- else {
+ if(!wildCard) {
+ remoteHnIndex=0;
+ } else {
patternIndex=1;
remoteHnIndex++;
}
- for(int i=remoteHnIndex ;i<remoteHostName.length;i++)
- if(!pat[patternIndex++].equalsIgnoreCase(remoteHostName[i]))
- return false;
+ for(int i=remoteHnIndex ;i<remoteHostName.length;i++) {
+ if(!pat[patternIndex++].equalsIgnoreCase(remoteHostName[i])) {
+ return false;
+ }
+ }
return true;
}
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/authorization/dseecompat/DayOfWeek.java b/opendj-server-legacy/src/main/java/org/opends/server/authorization/dseecompat/DayOfWeek.java
index eefdb2d..120d120 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/authorization/dseecompat/DayOfWeek.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/authorization/dseecompat/DayOfWeek.java
@@ -95,7 +95,9 @@
EnumDayOfWeek dayofweek
= EnumDayOfWeek.getDayOfWeek(calendar.get(Calendar.DAY_OF_WEEK));
if(days.contains(dayofweek))
- matched=EnumEvalResult.TRUE;
+ {
+ matched=EnumEvalResult.TRUE;
+ }
return matched.getRet(type, false);
}
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/authorization/dseecompat/EnumRight.java b/opendj-server-legacy/src/main/java/org/opends/server/authorization/dseecompat/EnumRight.java
index 5ee29bc..2a8d1fe 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/authorization/dseecompat/EnumRight.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/authorization/dseecompat/EnumRight.java
@@ -22,7 +22,7 @@
*
*
* Copyright 2008 Sun Microsystems, Inc.
- * Portions Copyright 2013 ForgeRock AS
+ * Portions Copyright 2013-2015 ForgeRock AS
*/
package org.opends.server.authorization.dseecompat;
@@ -209,11 +209,17 @@
// ALL already existed when they got added. For compatibility reasons
// with existing deployments, they were not included in ALL.
if (hasRights(rightsMask, ACI_EXPORT))
- results.add(EXPORT);
+ {
+ results.add(EXPORT);
+ }
if (hasRights(rightsMask, ACI_IMPORT))
- results.add(IMPORT);
+ {
+ results.add(IMPORT);
+ }
if (hasRights(rightsMask, ACI_PROXY))
- results.add(PROXY);
+ {
+ results.add(PROXY);
+ }
if (hasRights(rightsMask, ACI_ALL)) {
results.add(ALL);
@@ -221,19 +227,33 @@
}
// the remaining rights are already included in ALL
if (hasRights(rightsMask, ACI_READ))
- results.add(READ);
+ {
+ results.add(READ);
+ }
if (hasRights(rightsMask, ACI_WRITE))
- results.add(WRITE);
+ {
+ results.add(WRITE);
+ }
if (hasRights(rightsMask, ACI_ADD))
- results.add(ADD);
+ {
+ results.add(ADD);
+ }
if (hasRights(rightsMask, ACI_DELETE))
- results.add(DELETE);
+ {
+ results.add(DELETE);
+ }
if (hasRights(rightsMask, ACI_SEARCH))
- results.add(SEARCH);
+ {
+ results.add(SEARCH);
+ }
if (hasRights(rightsMask, ACI_COMPARE))
- results.add(COMPARE);
- if (hasRights(rightsMask, ACI_SELF)) // included in WRITE
- results.add(SELFWRITE);
+ {
+ results.add(COMPARE);
+ }
+ if (hasRights(rightsMask, ACI_SELF))
+ {
+ results.add(SELFWRITE);
+ }
return results;
}
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/authorization/dseecompat/ExtOp.java b/opendj-server-legacy/src/main/java/org/opends/server/authorization/dseecompat/ExtOp.java
index 83eed6d..4d372aa 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/authorization/dseecompat/ExtOp.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/authorization/dseecompat/ExtOp.java
@@ -85,15 +85,21 @@
*/
public boolean isApplicable(AciTargetMatchContext matchCtx) {
if(matchCtx.getExtOpOID() == null)
+ {
return false;
+ }
boolean ret = false;
for(String oid : extOpOIDs)
+ {
if(oid.equals("*") || matchCtx.getExtOpOID().equals(oid)) {
ret=true;
break;
}
- if(op.equals(EnumTargetOperator.NOT_EQUALITY))
- ret = !ret;
+ }
+ if(op.equals(EnumTargetOperator.NOT_EQUALITY))
+ {
+ ret = !ret;
+ }
return ret;
}
}
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/authorization/dseecompat/ParentInheritance.java b/opendj-server-legacy/src/main/java/org/opends/server/authorization/dseecompat/ParentInheritance.java
index 47ea1c8..46a82b1 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/authorization/dseecompat/ParentInheritance.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/authorization/dseecompat/ParentInheritance.java
@@ -109,7 +109,9 @@
numLevels=1;
levels[0]=0;
}
- } else parse(pattern);
+ } else {
+ parse(pattern);
+ }
}
/**
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 cbe96b3..fe40c6b 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
@@ -162,20 +162,24 @@
IPType ipType=IPType.IPv4;
byte[] prefixBytes;
String addrStr;
- if(expr.indexOf(':') != -1)
+ if(expr.indexOf(':') != -1) {
ipType = IPType.IPv6;
+ }
if(expr.indexOf('/') != -1) {
String prefixStr=null;
String[] s = expr.split("[/]", -1);
- if(s.length == 2) prefixStr=s[1];
+ if(s.length == 2) {
+ prefixStr=s[1];
+ }
int prefix = getPrefixValue(ipType, s.length, expr, prefixStr);
prefixBytes=getPrefixBytes(prefix, ipType);
addrStr=s[0];
} else if(expr.indexOf('+') != -1) {
String netMaskStr=null;
String[] s = expr.split("[+]", -1);
- if(s.length == 2)
+ if(s.length == 2) {
netMaskStr=s[1];
+ }
prefixBytes=getNetmaskBytes(netMaskStr, s.length, expr);
addrStr=s[0];
} else {
@@ -183,13 +187,12 @@
prefixBytes=getPrefixBytes(prefix, ipType);
addrStr=expr;
}
- //Set the bit set size fo IN6ADDRSZ even though only 4 positions are
- //used.
+ // Set the bit set size fo IN6ADDRSZ even though only 4 positions are used.
BitSet wildCardBitSet = new BitSet(IN6ADDRSZ);
byte[] addrBytes;
- if(ipType == IPType.IPv4)
- addrBytes = procIPv4Addr(addrStr, wildCardBitSet, expr);
- else {
+ if(ipType == IPType.IPv4) {
+ addrBytes = procIPv4Addr(addrStr, wildCardBitSet, expr);
+ } else {
addrBytes=procIPv6Addr(addrStr, expr);
//The IPv6 address processed above might be a IPv4-compatible
//address, in which case only 4 bytes will be returned in the
@@ -233,8 +236,9 @@
WARN_ACI_SYNTAX_INVALID_PREFIX_FORMAT.get(expr);
throw new AciException(message);
}
- if(prefixStr != null)
+ if(prefixStr != null) {
prefix = Integer.parseInt(prefixStr);
+ }
//Must be between 0 to maxprefix.
if((prefix < 0) || (prefix > maxPrefix)) {
LocalizableMessage message =
@@ -261,8 +265,9 @@
private static byte[] getPrefixBytes(int prefix, IPType ipType) {
int i;
int maxSize=IN4ADDRSZ;
- if(ipType==IPType.IPv6)
+ if(ipType==IPType.IPv6) {
maxSize= IN6ADDRSZ;
+ }
byte[] prefixBytes=new byte[maxSize];
for(i=0;prefix > 8 ; i++) {
prefixBytes[i] = (byte) 0xff;
@@ -276,7 +281,7 @@
* Process the specified netmask string. Only pertains to IPv4 address
* expressions.
*
- * @param netmaskStr String represntation of the netmask parsed from the
+ * @param netmaskStr String representation of the netmask parsed from the
* address expression.
* @param numParts The number of parts in the IP address expression.
* 1 if there isn't a netmask, and 2 if there is. Anything
@@ -342,8 +347,9 @@
}
for(int i=0; i < IN4ADDRSZ; i++) {
String quad=s[i].trim();
- if(quad.equals("*"))
+ if(quad.equals("*")) {
wildCardBitSet.set(i) ;
+ }
else {
long val=Integer.parseInt(quad);
//must be between 0-255
@@ -406,13 +412,16 @@
ipType=IPType.IPv6;
Inet6Address addr6 = (Inet6Address) remoteAddr;
addressBytes= addr6.getAddress();
- if(addr6.isIPv4CompatibleAddress())
+ if(addr6.isIPv4CompatibleAddress()) {
ipType=IPType.IPv4;
+ }
}
- if(ipType != this.ipType)
+ if(ipType != this.ipType) {
return EnumEvalResult.FALSE;
- if(matchAddress(addressBytes))
+ }
+ if(matchAddress(addressBytes)) {
matched=EnumEvalResult.TRUE;
+ }
return matched;
}
@@ -426,13 +435,16 @@
* parsed from the IP bind rule expression.
*/
private boolean matchAddress(byte[] addrBytes) {
- if(wildCardBitSet.cardinality() == IN4ADDRSZ)
+ if(wildCardBitSet.cardinality() == IN4ADDRSZ) {
return true;
+ }
for(int i=0;i <rulePrefixBytes.length; i++) {
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/Permission.java b/opendj-server-legacy/src/main/java/org/opends/server/authorization/dseecompat/Permission.java
index cd4345b..7256e31 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/authorization/dseecompat/Permission.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/authorization/dseecompat/Permission.java
@@ -91,9 +91,9 @@
separatorPattern.split(rights.replaceAll("\\s", ""));
for (String r : rightsStr) {
EnumRight right = EnumRight.decode(r);
- if (right != null)
- this.rights|= EnumRight.getMask(right);
- else {
+ if (right != null) {
+ this.rights|= EnumRight.getMask(right);
+ } else {
LocalizableMessage message =
WARN_ACI_SYNTAX_INVALID_RIGHTS_KEYWORD.get(rights);
throw new AciException(message);
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/authorization/dseecompat/SSF.java b/opendj-server-legacy/src/main/java/org/opends/server/authorization/dseecompat/SSF.java
index ed65f35..4e7fa5e 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/authorization/dseecompat/SSF.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/authorization/dseecompat/SSF.java
@@ -78,37 +78,46 @@
* context evaluation.
*/
public EnumEvalResult evaluate(AciEvalContext evalCtx) {
- EnumEvalResult matched=EnumEvalResult.FALSE;
int currentSSF = evalCtx.getCurrentSSF();
- switch (type) {
- case EQUAL_BINDRULE_TYPE:
- case NOT_EQUAL_BINDRULE_TYPE:
- if (currentSSF == ssf)
- matched=EnumEvalResult.TRUE;
- break;
-
- case LESS_OR_EQUAL_BINDRULE_TYPE:
- if (currentSSF <= ssf)
- matched=EnumEvalResult.TRUE;
- break;
-
- case LESS_BINDRULE_TYPE:
- if (currentSSF < ssf)
- matched=EnumEvalResult.TRUE;
- break;
-
- case GREATER_OR_EQUAL_BINDRULE_TYPE:
- if (currentSSF >= ssf)
- matched=EnumEvalResult.TRUE;
- break;
-
- case GREATER_BINDRULE_TYPE:
- if (currentSSF > ssf)
- matched=EnumEvalResult.TRUE;
- }
+ EnumEvalResult matched = getMatched(currentSSF);
return matched.getRet(type, false);
}
+ private EnumEvalResult getMatched(int currentSSF) {
+ switch (type) {
+ case EQUAL_BINDRULE_TYPE:
+ case NOT_EQUAL_BINDRULE_TYPE:
+ if (currentSSF == ssf) {
+ return EnumEvalResult.TRUE;
+ }
+ break;
+
+ case LESS_OR_EQUAL_BINDRULE_TYPE:
+ if (currentSSF <= ssf) {
+ return EnumEvalResult.TRUE;
+ }
+ break;
+
+ case LESS_BINDRULE_TYPE:
+ if (currentSSF < ssf) {
+ return EnumEvalResult.TRUE;
+ }
+ break;
+
+ case GREATER_OR_EQUAL_BINDRULE_TYPE:
+ if (currentSSF >= ssf) {
+ return EnumEvalResult.TRUE;
+ }
+ break;
+
+ case GREATER_BINDRULE_TYPE:
+ if (currentSSF > ssf) {
+ return EnumEvalResult.TRUE;
+ }
+ }
+ return EnumEvalResult.FALSE;
+ }
+
/** {@inheritDoc} */
@Override
public String toString()
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/authorization/dseecompat/TargAttrFilterList.java b/opendj-server-legacy/src/main/java/org/opends/server/authorization/dseecompat/TargAttrFilterList.java
index 3edaf98..f812190 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/authorization/dseecompat/TargAttrFilterList.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/authorization/dseecompat/TargAttrFilterList.java
@@ -128,7 +128,9 @@
//handling.
int semicolon = attributeName.indexOf(';');
if (semicolon != -1)
- attributeName=attributeName.substring(0, semicolon);
+ {
+ attributeName=attributeName.substring(0, semicolon);
+ }
String filterString=matcher.group(filterPos);
AttributeType attrType = DirectoryServer.getAttributeType(attributeName);
if (attrType == null) {
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/authorization/dseecompat/TargAttrFilters.java b/opendj-server-legacy/src/main/java/org/opends/server/authorization/dseecompat/TargAttrFilters.java
index f2ac22a..8742641 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/authorization/dseecompat/TargAttrFilters.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/authorization/dseecompat/TargAttrFilters.java
@@ -231,7 +231,9 @@
private static String getReverseOp(String op)
{
if (getMask(op) == TARGATTRFILTERS_DELETE)
+ {
return "add";
+ }
return "del";
}
@@ -243,7 +245,9 @@
*/
private static int getMask(String op) {
if(op.equals("add"))
- return TARGATTRFILTERS_ADD;
+ {
+ return TARGATTRFILTERS_ADD;
+ }
return TARGATTRFILTERS_DELETE;
}
@@ -261,19 +265,27 @@
//context's rights and the mask.
if((matchCtx.hasRights(ACI_WRITE_ADD) || matchCtx.hasRights(ACI_ADD)) &&
hasMask(TARGATTRFILTERS_ADD))
- mask=TARGATTRFILTERS_ADD;
+ {
+ mask=TARGATTRFILTERS_ADD;
+ }
else if((matchCtx.hasRights(ACI_WRITE_DELETE) ||
matchCtx.hasRights(ACI_DELETE)) &&
hasMask(TARGATTRFILTERS_DELETE))
- mask=TARGATTRFILTERS_DELETE;
+ {
+ mask=TARGATTRFILTERS_DELETE;
+ }
//Check the first list first, it always has to be there. If it doesn't
//match then check the second if it exists.
if(firstFilterList.hasMask(mask))
- return firstFilterList;
+ {
+ return firstFilterList;
+ }
else if((secondFilterList != null) &&
secondFilterList.hasMask(mask))
- return secondFilterList;
+ {
+ return secondFilterList;
+ }
return null;
}
@@ -294,7 +306,9 @@
//If the list is empty return true and go on to the targattr check
//in AciTargets.isApplicable().
if(attrFilterList == null)
- return true;
+ {
+ return true;
+ }
Map<AttributeType, SearchFilter> filterList =
attrFilterList.getAttributeTypeFilterList();
boolean attrMatched=true;
@@ -324,7 +338,9 @@
boolean result)
{
if (EnumTargetOperator.NOT_EQUALITY.equals(op))
+ {
return !result;
+ }
return result;
}
@@ -341,7 +357,9 @@
TargAttrFilterList attrFilterList=getTargAttrFilterList(matchCtx);
//List didn't match current operation return true.
if(attrFilterList == null)
- return true;
+ {
+ return true;
+ }
Map<AttributeType, SearchFilter> filterList =
attrFilterList.getAttributeTypeFilterList();
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 444bb23..b77f18f 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
@@ -113,7 +113,9 @@
String attribute = attr.toLowerCase();
if(attribute.equals("*")) {
if(!allUserAttributes)
- allUserAttributes=true;
+ {
+ allUserAttributes=true;
+ }
else {
LocalizableMessage message =
WARN_ACI_TARGETATTR_INVALID_ATTR_TOKEN.get(attrStr);
@@ -121,7 +123,9 @@
}
} else if(attribute.equals("+")) {
if(!allOpAttributes)
- allOpAttributes=true;
+ {
+ allOpAttributes=true;
+ }
else {
LocalizableMessage message =
WARN_ACI_TARGETATTR_INVALID_ATTR_TOKEN.get(attrStr);
@@ -133,9 +137,13 @@
attrType = DirectoryServer.getDefaultAttributeType(attribute);
}
if(attrType.isOperational())
- opAttributes.add(attrType);
+ {
+ opAttributes.add(attrType);
+ }
else
- attributes.add(attrType);
+ {
+ attributes.add(attrType);
+ }
}
}
}
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/authorization/dseecompat/TargetControl.java b/opendj-server-legacy/src/main/java/org/opends/server/authorization/dseecompat/TargetControl.java
index e5bcc23..80e234a 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/authorization/dseecompat/TargetControl.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/authorization/dseecompat/TargetControl.java
@@ -80,15 +80,21 @@
*/
public boolean isApplicable(AciTargetMatchContext matchCtx) {
if(matchCtx.getControlOID() == null)
+ {
return false;
+ }
boolean ret = false;
for(String oid : controlOIDS)
+ {
if(oid.equals("*") || matchCtx.getControlOID().equals(oid)) {
ret=true;
break;
}
- if(op.equals(EnumTargetOperator.NOT_EQUALITY))
- ret = !ret;
+ }
+ if(op.equals(EnumTargetOperator.NOT_EQUALITY))
+ {
+ ret = !ret;
+ }
return ret;
}
}
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/authorization/dseecompat/TargetFilter.java b/opendj-server-legacy/src/main/java/org/opends/server/authorization/dseecompat/TargetFilter.java
index ccdcaca..d7ae903 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/authorization/dseecompat/TargetFilter.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/authorization/dseecompat/TargetFilter.java
@@ -83,7 +83,9 @@
boolean ret;
ret=matchesFilter(matchCtx.getResourceEntry());
if(op.equals(EnumTargetOperator.NOT_EQUALITY))
- ret = !ret;
+ {
+ ret = !ret;
+ }
return ret;
}
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/authorization/dseecompat/UserDN.java b/opendj-server-legacy/src/main/java/org/opends/server/authorization/dseecompat/UserDN.java
index d5fd820..dc1df74 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/authorization/dseecompat/UserDN.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/authorization/dseecompat/UserDN.java
@@ -191,9 +191,14 @@
//Handle anonymous checks here
if(isAnonUser) {
if(dnTypeURL.getUserDNType() == EnumUserDNType.ANYONE)
- matched = EnumEvalResult.TRUE;
- } else
- matched=evalNonAnonymous(evalCtx, dnTypeURL);
+ {
+ matched = EnumEvalResult.TRUE;
+ }
+ }
+ else
+ {
+ matched=evalNonAnonymous(evalCtx, dnTypeURL);
+ }
}
return matched.getRet(type, undefined);
}
@@ -227,7 +232,10 @@
}
case SELF:
{
- if (clientDN.equals(resDN)) matched = EnumEvalResult.TRUE;
+ if (clientDN.equals(resDN))
+ {
+ matched = EnumEvalResult.TRUE;
+ }
break;
}
case PARENT:
@@ -235,7 +243,9 @@
DN parentDN = resDN.parent();
if ((parentDN != null) &&
(parentDN.equals(clientDN)))
- matched = EnumEvalResult.TRUE;
+ {
+ matched = EnumEvalResult.TRUE;
+ }
break;
}
case ALL:
@@ -254,7 +264,9 @@
{
DN dn = url.getBaseDN();
if (clientDN.equals(dn))
- matched = EnumEvalResult.TRUE;
+ {
+ matched = EnumEvalResult.TRUE;
+ }
else {
//This code handles the case where a root dn entry does
//not have bypass-acl privilege and the ACI bind rule
@@ -263,11 +275,17 @@
DN clientActualDN=
DirectoryServer.getActualRootBindDN(clientDN);
if(actualDN != null)
- dn=actualDN;
+ {
+ dn=actualDN;
+ }
if(clientActualDN != null)
- clientDN=clientActualDN;
+ {
+ clientDN=clientActualDN;
+ }
if(clientDN.equals(dn))
- matched=EnumEvalResult.TRUE;
+ {
+ matched=EnumEvalResult.TRUE;
+ }
}
} catch (DirectoryException ex) {
//TODO add message
@@ -319,11 +337,15 @@
SearchScope scope=url.getScope();
if(scope == SearchScope.WHOLE_SUBTREE) {
if(!evalCtx.getClientDN().isDescendantOf(urlDN))
- return EnumEvalResult.FALSE;
+ {
+ return EnumEvalResult.FALSE;
+ }
} else if(scope == SearchScope.SINGLE_LEVEL) {
DN parent=evalCtx.getClientDN().parent();
if((parent != null) && !parent.equals(urlDN))
- return EnumEvalResult.FALSE;
+ {
+ return EnumEvalResult.FALSE;
+ }
} else if(scope == SearchScope.SUBORDINATES) {
DN userDN = evalCtx.getClientDN();
if ((userDN.size() <= urlDN.size()) ||
@@ -332,11 +354,15 @@
}
} else {
if(!evalCtx.getClientDN().equals(urlDN))
- return EnumEvalResult.FALSE;
+ {
+ return EnumEvalResult.FALSE;
+ }
}
try {
if(filter.matchesEntry(evalCtx.getClientEntry()))
- ret=EnumEvalResult.TRUE;
+ {
+ ret=EnumEvalResult.TRUE;
+ }
} catch (DirectoryException ex) {
return EnumEvalResult.FALSE;
}
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/controls/GetEffectiveRightsRequestControl.java b/opendj-server-legacy/src/main/java/org/opends/server/controls/GetEffectiveRightsRequestControl.java
index 3b09708..0b371d2 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/controls/GetEffectiveRightsRequestControl.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/controls/GetEffectiveRightsRequestControl.java
@@ -87,8 +87,10 @@
// class with null authzDN and attribute list, else try to
// decode the value.
if (value == null)
+ {
return new GetEffectiveRightsRequestControl(isCritical, (DN)null,
(List<AttributeType>)null);
+ }
else
{
ASN1Reader reader = ASN1.getReader(value);
@@ -101,7 +103,9 @@
String lowerAuthzIDString = authzIDString.toLowerCase();
//Make sure authzId starts with "dn:" and is a valid DN.
if (lowerAuthzIDString.startsWith("dn:"))
+ {
authzDN = DN.valueOf(authzIDString.substring(3));
+ }
else {
LocalizableMessage message = INFO_GETEFFECTIVERIGHTS_INVALID_AUTHZID.get(
lowerAuthzIDString);
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/controls/PagedResultsControl.java b/opendj-server-legacy/src/main/java/org/opends/server/controls/PagedResultsControl.java
index 79292a2..c944c21 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/controls/PagedResultsControl.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/controls/PagedResultsControl.java
@@ -171,9 +171,13 @@
this.size = size;
if(cookie == null)
- this.cookie=ByteString.empty();
+ {
+ this.cookie=ByteString.empty();
+ }
else
- this.cookie = cookie;
+ {
+ this.cookie = cookie;
+ }
}
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/extensions/AESPasswordStorageScheme.java b/opendj-server-legacy/src/main/java/org/opends/server/extensions/AESPasswordStorageScheme.java
index 31af84b..51def31 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/extensions/AESPasswordStorageScheme.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/extensions/AESPasswordStorageScheme.java
@@ -122,7 +122,9 @@
finally
{
if (plaintextBytes != null)
+ {
Arrays.fill(plaintextBytes, (byte) 0);
+ }
}
}
@@ -157,7 +159,9 @@
finally
{
if (plaintextBytes != null)
+ {
Arrays.fill(plaintextBytes, (byte) 0);
+ }
}
return ByteString.valueOf(buffer);
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/extensions/BlowfishPasswordStorageScheme.java b/opendj-server-legacy/src/main/java/org/opends/server/extensions/BlowfishPasswordStorageScheme.java
index b571a1f..528235c 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/extensions/BlowfishPasswordStorageScheme.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/extensions/BlowfishPasswordStorageScheme.java
@@ -128,7 +128,9 @@
finally
{
if (plaintextBytes != null)
+ {
Arrays.fill(plaintextBytes, (byte) 0);
+ }
}
}
@@ -166,7 +168,9 @@
finally
{
if (plaintextBytes != null)
+ {
Arrays.fill(plaintextBytes, (byte) 0);
+ }
}
return ByteString.valueOf(buffer);
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/extensions/CryptPasswordStorageScheme.java b/opendj-server-legacy/src/main/java/org/opends/server/extensions/CryptPasswordStorageScheme.java
index a82aee4..17623a5 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/extensions/CryptPasswordStorageScheme.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/extensions/CryptPasswordStorageScheme.java
@@ -142,7 +142,9 @@
finally
{
if (plaintextBytes != null)
+ {
Arrays.fill(plaintextBytes, (byte) 0);
+ }
}
return ByteString.wrap(digestBytes);
@@ -204,7 +206,9 @@
finally
{
if (plaintextBytes != null)
+ {
Arrays.fill(plaintextBytes, (byte) 0);
+ }
}
return ByteString.valueOf(output);
}
@@ -229,7 +233,9 @@
finally
{
if (plaintextBytes != null)
+ {
Arrays.fill(plaintextBytes, (byte) 0);
+ }
}
return ByteString.valueOf(output);
}
@@ -302,7 +308,9 @@
finally
{
if (plaintextPasswordBytes != null)
+ {
Arrays.fill(plaintextPasswordBytes, (byte) 0);
+ }
}
return userPWDigestBytes.equals(storedPassword);
@@ -342,7 +350,9 @@
finally
{
if (plaintextPasswordBytes != null)
+ {
Arrays.fill(plaintextPasswordBytes, (byte) 0);
+ }
}
}
@@ -364,7 +374,9 @@
finally
{
if (plaintextPasswordBytes != null)
+ {
Arrays.fill(plaintextPasswordBytes, (byte) 0);
+ }
}
}
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/extensions/DigestMD5SASLMechanismHandler.java b/opendj-server-legacy/src/main/java/org/opends/server/extensions/DigestMD5SASLMechanismHandler.java
index a0cd7dd..b7b1848 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/extensions/DigestMD5SASLMechanismHandler.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/extensions/DigestMD5SASLMechanismHandler.java
@@ -252,12 +252,13 @@
private String
getQOP(DigestMD5SASLMechanismHandlerCfg configuration) {
QualityOfProtection QOP = configuration.getQualityOfProtection();
- if(QOP.equals(QualityOfProtection.CONFIDENTIALITY))
- return "auth-conf";
- else if(QOP.equals(QualityOfProtection.INTEGRITY))
- return "auth-int";
- else
- return "auth";
+ if(QOP.equals(QualityOfProtection.CONFIDENTIALITY)) {
+ return "auth-conf";
+ } else if(QOP.equals(QualityOfProtection.INTEGRITY)) {
+ return "auth-int";
+ } else {
+ return "auth";
+ }
}
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/extensions/GSSAPISASLMechanismHandler.java b/opendj-server-legacy/src/main/java/org/opends/server/extensions/GSSAPISASLMechanismHandler.java
index 48ee88b..a75d222 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/extensions/GSSAPISASLMechanismHandler.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/extensions/GSSAPISASLMechanismHandler.java
@@ -420,8 +420,10 @@
message.append("major code (").append(gex.getMajor()).append(") ")
.append(gex.getMajorString());
if(gex.getMinor() != 0)
+ {
message.append(", minor code (").append(gex.getMinor()).append(") ")
.append(gex.getMinorString());
+ }
return message.toMessage();
}
@@ -577,11 +579,12 @@
private String getQOP(GSSAPISASLMechanismHandlerCfg configuration)
{
QualityOfProtection QOP = configuration.getQualityOfProtection();
- if (QOP.equals(QualityOfProtection.CONFIDENTIALITY))
+ if (QOP.equals(QualityOfProtection.CONFIDENTIALITY)) {
return "auth-conf";
- else if (QOP.equals(QualityOfProtection.INTEGRITY))
+ } else if (QOP.equals(QualityOfProtection.INTEGRITY)) {
return "auth-int";
- else
+ } else {
return "auth";
+ }
}
}
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/extensions/MD5PasswordStorageScheme.java b/opendj-server-legacy/src/main/java/org/opends/server/extensions/MD5PasswordStorageScheme.java
index fd511d9..bef0c99 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/extensions/MD5PasswordStorageScheme.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/extensions/MD5PasswordStorageScheme.java
@@ -153,7 +153,9 @@
finally
{
if (plaintextBytes != null)
+ {
Arrays.fill(plaintextBytes, (byte) 0);
+ }
}
}
@@ -195,7 +197,9 @@
finally
{
if (plaintextBytes != null)
+ {
Arrays.fill(plaintextBytes, (byte) 0);
+ }
}
}
@@ -233,7 +237,9 @@
finally
{
if (plaintextPasswordBytes != null)
+ {
Arrays.fill(plaintextPasswordBytes, (byte) 0);
+ }
}
}
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/extensions/RC4PasswordStorageScheme.java b/opendj-server-legacy/src/main/java/org/opends/server/extensions/RC4PasswordStorageScheme.java
index b05a21e..713e5c7 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/extensions/RC4PasswordStorageScheme.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/extensions/RC4PasswordStorageScheme.java
@@ -127,7 +127,9 @@
finally
{
if (plaintextBytes != null)
+ {
Arrays.fill(plaintextBytes, (byte) 0);
+ }
}
}
@@ -165,7 +167,9 @@
finally
{
if (plaintextBytes != null)
+ {
Arrays.fill(plaintextBytes, (byte) 0);
+ }
}
return ByteString.valueOf(buffer);
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/extensions/SHA1PasswordStorageScheme.java b/opendj-server-legacy/src/main/java/org/opends/server/extensions/SHA1PasswordStorageScheme.java
index e211e02..df0edc2 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/extensions/SHA1PasswordStorageScheme.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/extensions/SHA1PasswordStorageScheme.java
@@ -152,7 +152,9 @@
finally
{
if (plaintextBytes != null)
+ {
Arrays.fill(plaintextBytes, (byte) 0);
+ }
}
}
@@ -194,7 +196,9 @@
finally
{
if (plaintextBytes != null)
+ {
Arrays.fill(plaintextBytes, (byte) 0);
+ }
}
}
@@ -231,7 +235,9 @@
finally
{
if (plaintextPasswordBytes != null)
+ {
Arrays.fill(plaintextPasswordBytes, (byte) 0);
+ }
}
}
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/extensions/TripleDESPasswordStorageScheme.java b/opendj-server-legacy/src/main/java/org/opends/server/extensions/TripleDESPasswordStorageScheme.java
index d0ad0f9..5ff6d7b 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/extensions/TripleDESPasswordStorageScheme.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/extensions/TripleDESPasswordStorageScheme.java
@@ -128,7 +128,9 @@
finally
{
if (plaintextBytes != null)
+ {
Arrays.fill(plaintextBytes, (byte) 0);
+ }
}
}
@@ -166,7 +168,9 @@
finally
{
if (plaintextBytes != null)
+ {
Arrays.fill(plaintextBytes, (byte) 0);
+ }
}
return ByteString.valueOf(buffer);
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/loggers/AsynchronousTextWriter.java b/opendj-server-legacy/src/main/java/org/opends/server/loggers/AsynchronousTextWriter.java
index e30e8a2..f1d5866 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/loggers/AsynchronousTextWriter.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/loggers/AsynchronousTextWriter.java
@@ -257,7 +257,10 @@
}
// Shutdown the wrapped writer.
- if (shutdownWrapped && writer != null) writer.shutdown();
+ if (shutdownWrapped && writer != null)
+ {
+ writer.shutdown();
+ }
DirectoryServer.deregisterShutdownListener(this);
}
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/loggers/DebugMessageFormatter.java b/opendj-server-legacy/src/main/java/org/opends/server/loggers/DebugMessageFormatter.java
index 90ab922..1b0a288 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/loggers/DebugMessageFormatter.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/loggers/DebugMessageFormatter.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;
@@ -135,7 +135,10 @@
StringBuilder buffer= new StringBuilder();
buffer.append("[ ");
for (int i= 0; i < array.length; i++) {
- if (i > 0) buffer.append(", ");
+ if (i > 0)
+ {
+ buffer.append(", ");
+ }
buffer.append(array[i]);
}
buffer.append(" ]");
@@ -148,7 +151,10 @@
StringBuilder buffer= new StringBuilder();
buffer.append("[ ");
for (int i= 0; i < array.length; i++) {
- if (i > 0) buffer.append(", ");
+ if (i > 0)
+ {
+ buffer.append(", ");
+ }
buffer.append(array[i]);
}
buffer.append(" ]");
@@ -161,7 +167,10 @@
StringBuilder buffer= new StringBuilder();
buffer.append("[ ");
for (int i= 0; i < array.length; i++) {
- if (i > 0) buffer.append(", ");
+ if (i > 0)
+ {
+ buffer.append(", ");
+ }
buffer.append(array[i]);
}
buffer.append(" ]");
@@ -174,7 +183,10 @@
StringBuilder buffer= new StringBuilder();
buffer.append("[ ");
for (int i= 0; i < array.length; i++) {
- if (i > 0) buffer.append(", ");
+ if (i > 0)
+ {
+ buffer.append(", ");
+ }
buffer.append(array[i]);
}
buffer.append(" ]");
@@ -187,7 +199,10 @@
StringBuilder buffer= new StringBuilder();
buffer.append("[ ");
for (int i= 0; i < array.length; i++) {
- if (i > 0) buffer.append(", ");
+ if (i > 0)
+ {
+ buffer.append(", ");
+ }
buffer.append(array[i]);
}
buffer.append(" ]");
@@ -200,7 +215,10 @@
StringBuilder buffer= new StringBuilder();
buffer.append("[ ");
for (int i= 0; i < array.length; i++) {
- if (i > 0) buffer.append(", ");
+ if (i > 0)
+ {
+ buffer.append(", ");
+ }
buffer.append(array[i]);
}
buffer.append(" ]");
@@ -213,7 +231,10 @@
StringBuilder buffer= new StringBuilder();
buffer.append("[ ");
for (int i= 0; i < array.length; i++) {
- if (i > 0) buffer.append(", ");
+ if (i > 0)
+ {
+ buffer.append(", ");
+ }
buffer.append(array[i]);
}
buffer.append(" ]");
@@ -229,7 +250,10 @@
boolean firstElement= true;
while (iter.hasNext()) {
Object lValue= iter.next();
- if (!firstElement) buffer.append(", ");
+ if (!firstElement)
+ {
+ buffer.append(", ");
+ }
buffer.append(decorateArg(lValue));
firstElement= false;
}
@@ -246,7 +270,10 @@
boolean firstEntry= true;
while (iter.hasNext()) {
Map.Entry entry= (Map.Entry)iter.next();
- if (!firstEntry) buffer.append(", ");
+ if (!firstEntry)
+ {
+ buffer.append(", ");
+ }
buffer.append(decorateArg(entry.getKey()));
buffer.append("=");
buffer.append(decorateArg(entry.getValue()));
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/loggers/DebugStackTraceFormatter.java b/opendj-server-legacy/src/main/java/org/opends/server/loggers/DebugStackTraceFormatter.java
index 4063be3..37ccd03 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/loggers/DebugStackTraceFormatter.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/loggers/DebugStackTraceFormatter.java
@@ -214,12 +214,14 @@
// Recurse if we have a cause
Throwable ourCause = t.getCause();
if (ourCause != null)
+ {
formatStackTraceForCause(ourCause, maxDepth, buffer, trace);
+ }
}
/**
* Generate a String representation of the possibly filtered stack trace from
- * the current position in executation.
+ * the current position in execution.
*
* @param stackTrace
* - The stack trace elements to format.
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/loggers/ParallelTextWriter.java b/opendj-server-legacy/src/main/java/org/opends/server/loggers/ParallelTextWriter.java
index 962a3fc..2cd8ba9 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/loggers/ParallelTextWriter.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/loggers/ParallelTextWriter.java
@@ -230,7 +230,10 @@
}
// Shutdown the wrapped writer.
- if (shutdownWrapped && writer != null) writer.shutdown();
+ if (shutdownWrapped && writer != null)
+ {
+ writer.shutdown();
+ }
DirectoryServer.deregisterShutdownListener(this);
}
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/protocols/http/CollectClientConnectionsFilter.java b/opendj-server-legacy/src/main/java/org/opends/server/protocols/http/CollectClientConnectionsFilter.java
index f4db338..6c70ae6 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/protocols/http/CollectClientConnectionsFilter.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/protocols/http/CollectClientConnectionsFilter.java
@@ -21,7 +21,7 @@
* CDDL HEADER END
*
*
- * Portions Copyright 2013-2014 ForgeRock AS
+ * Portions Copyright 2013-2015 ForgeRock AS
*/
package org.opends.server.protocols.http;
@@ -482,13 +482,21 @@
final String indent = "\n ";
final StringBuilder sb = new StringBuilder();
sb.append("{");
- if (prettyPrint) sb.append(indent);
+ if (prettyPrint) {
+ sb.append(indent);
+ }
sb.append("\"code\": ").append(re.getCode()).append(",");
- if (prettyPrint) sb.append(indent);
+ if (prettyPrint) {
+ sb.append(indent);
+ }
sb.append("\"message\": \"").append(re.getMessage()).append("\",");
- if (prettyPrint) sb.append(indent);
+ if (prettyPrint) {
+ sb.append(indent);
+ }
sb.append("\"reason\": \"").append(re.getReason()).append("\"");
- if (prettyPrint) sb.append("\n");
+ if (prettyPrint) {
+ sb.append("\n");
+ }
sb.append("}");
return sb.toString();
}
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/protocols/jmx/DirectoryRMIServerSocketFactory.java b/opendj-server-legacy/src/main/java/org/opends/server/protocols/jmx/DirectoryRMIServerSocketFactory.java
index f27eb4f..65d77fa 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/protocols/jmx/DirectoryRMIServerSocketFactory.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/protocols/jmx/DirectoryRMIServerSocketFactory.java
@@ -159,12 +159,14 @@
*/
public boolean equals(Object obj)
{
- if (obj == null)
- return false;
if (obj == this)
+ {
return true;
+ }
if (!(obj instanceof DirectoryRMIServerSocketFactory))
+ {
return false;
+ }
DirectoryRMIServerSocketFactory that =
(DirectoryRMIServerSocketFactory) obj;
return (getClass().equals(that.getClass()) && checkParameters(that));
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/replication/plugin/AttrHistorical.java b/opendj-server-legacy/src/main/java/org/opends/server/replication/plugin/AttrHistorical.java
index f851ab7..b01f014 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/replication/plugin/AttrHistorical.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/replication/plugin/AttrHistorical.java
@@ -23,6 +23,7 @@
*
* Copyright 2006-2010 Sun Microsystems, Inc.
* Portions Copyright 2013-2014 ForgeRock, AS.
+ * Portions Copyright 2015 ForgeRock AS.
*/
package org.opends.server.replication.plugin;
@@ -81,10 +82,7 @@
public static AttrHistorical createAttributeHistorical(
AttributeType type)
{
- if (type.isSingleValue())
- return new AttrHistoricalSingle();
- else
- return new AttrHistoricalMultiple();
+ return type.isSingleValue() ? new AttrHistoricalSingle() : new AttrHistoricalMultiple();
}
/**
@@ -92,8 +90,7 @@
*
* @return the List of ValueInfo
*/
- public abstract Map<AttrValueHistorical,AttrValueHistorical>
- getValuesHistorical();
+ public abstract Map<AttrValueHistorical, AttrValueHistorical> getValuesHistorical();
/**
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/replication/plugin/AttrHistoricalMultiple.java b/opendj-server-legacy/src/main/java/org/opends/server/replication/plugin/AttrHistoricalMultiple.java
index 5e9eaa9..e11ecde 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/replication/plugin/AttrHistoricalMultiple.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/replication/plugin/AttrHistoricalMultiple.java
@@ -137,7 +137,9 @@
AttrValueHistorical info = it.next();
if (csn.isNewerThanOrEqualTo(info.getValueUpdateTime()) &&
csn.isNewerThanOrEqualTo(info.getValueDeleteTime()))
- it.remove();
+ {
+ it.remove();
+ }
}
if (csn.isNewerThan(deleteTime))
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/replication/plugin/AttrHistoricalSingle.java b/opendj-server-legacy/src/main/java/org/opends/server/replication/plugin/AttrHistoricalSingle.java
index 74ba9d9..473fd70 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/replication/plugin/AttrHistoricalSingle.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/replication/plugin/AttrHistoricalSingle.java
@@ -293,13 +293,17 @@
case DEL:
this.deleteTime = csn;
if (value != null)
+ {
this.value = value;
+ }
break;
case REPL:
this.addTime = this.deleteTime = csn;
if (value != null)
+ {
this.value = value;
+ }
break;
case DELATTR:
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/replication/plugin/FakeOperationComparator.java b/opendj-server-legacy/src/main/java/org/opends/server/replication/plugin/FakeOperationComparator.java
index 0efc229..6c41316 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/replication/plugin/FakeOperationComparator.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/replication/plugin/FakeOperationComparator.java
@@ -39,7 +39,9 @@
public int compare(FakeOperation op1, FakeOperation op2)
{
if (op1 == null)
+ {
return -1;
+ }
return op1.getCSN().compareTo(op2.getCSN());
}
}
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/replication/plugin/HistAttrModificationKey.java b/opendj-server-legacy/src/main/java/org/opends/server/replication/plugin/HistAttrModificationKey.java
index 9415761..16a5dbf 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/replication/plugin/HistAttrModificationKey.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/replication/plugin/HistAttrModificationKey.java
@@ -38,24 +38,13 @@
*/
public enum HistAttrModificationKey
{
- /**
- * The key for attribute value deletion.
- */
+ /** The key for attribute value deletion. */
DEL("del"),
-
- /**
- * The key for attribute deletion.
- */
+ /** The key for attribute deletion. */
DELATTR("delAttr"),
-
- /**
- * The key for attribute replace.
- */
+ /** The key for attribute replace. */
REPL("repl"),
-
- /**
- * The key for attribute value addition.
- */
+ /** The key for attribute value addition. */
ADD("add");
/** The string representation of this key. */
@@ -79,21 +68,15 @@
*/
public static HistAttrModificationKey decodeKey(String histkey)
{
- if (histkey == null)
- return null;
-
- if (histkey.compareTo("repl") == 0)
+ if ("repl".equals(histkey)) {
return HistAttrModificationKey.REPL;
-
- if (histkey.compareTo("add") == 0)
+ } else if ("add".equals(histkey)) {
return HistAttrModificationKey.ADD;
-
- if (histkey.compareTo("del") == 0)
+ } else if ("del".equals(histkey)) {
return HistAttrModificationKey.DEL;
-
- if (histkey.compareTo("attrDel") == 0)
+ } else if ("attrDel".equals(histkey)) {
return HistAttrModificationKey.DELATTR;
-
+ }
return null;
}
@@ -112,9 +95,9 @@
*
* @return A string representation of this HistKey.
*/
+ @Override
public String toString()
{
return key;
}
-
}
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/replication/plugin/HistoricalAttributeValue.java b/opendj-server-legacy/src/main/java/org/opends/server/replication/plugin/HistoricalAttributeValue.java
index 0655b93..1abfee7 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/replication/plugin/HistoricalAttributeValue.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/replication/plugin/HistoricalAttributeValue.java
@@ -116,7 +116,9 @@
// modifications were done to the entries.
attrType = DirectoryServer.getSchema().getAttributeType(attrString);
if (attrType == null)
+ {
attrType = DirectoryServer.getDefaultAttributeType(attrString);
+ }
}
else
{
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/replication/plugin/LDAPReplicationDomain.java b/opendj-server-legacy/src/main/java/org/opends/server/replication/plugin/LDAPReplicationDomain.java
index 6e7a86c..9dc7273 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/replication/plugin/LDAPReplicationDomain.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/replication/plugin/LDAPReplicationDomain.java
@@ -4135,21 +4135,25 @@
if (lastRetrievedChange != null)
{
if (logger.isInfoEnabled())
+ {
logger.info(LocalizableMessage.raw("publish loop"
+ " >=" + currentStartCSN + " <=" + endCSN
+ " nentries=" + op.getEntriesSent()
+ " result=" + op.getResultCode()
+ " lastRetrievedChange=" + lastRetrievedChange));
+ }
currentStartCSN = lastRetrievedChange;
}
else
{
if (logger.isInfoEnabled())
+ {
logger.info(LocalizableMessage.raw("publish loop"
+ " >=" + currentStartCSN + " <=" + endCSN
+ " nentries=" + op.getEntriesSent()
+ " result=" + op.getResultCode()
+ " no changes"));
+ }
currentStartCSN = endCSN;
}
} while (pendingChanges.recoveryUntil(currentStartCSN)
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 e02cf04..42068f4 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
@@ -122,7 +122,9 @@
protected byte[] encodeMods(List<Modification> mods)
{
if ((mods == null) || (mods.size() == 0))
+ {
return new byte[0];
+ }
ByteStringBuilder byteBuilder = new ByteStringBuilder();
ASN1Writer writer = ASN1.getWriter(byteBuilder);
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/replication/protocol/StopMsg.java b/opendj-server-legacy/src/main/java/org/opends/server/replication/protocol/StopMsg.java
index c03dbf0..a763c94 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/replication/protocol/StopMsg.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/replication/protocol/StopMsg.java
@@ -22,7 +22,7 @@
*
*
* Copyright 2009 Sun Microsystems, Inc.
- * Portions copyright 2013-2014 ForgeRock AS.
+ * Portions copyright 2013-2015 ForgeRock AS.
*/
package org.opends.server.replication.protocol;
@@ -52,18 +52,16 @@
{
// First byte is the type
if (in[0] != MSG_TYPE_STOP)
- throw new DataFormatException("input is not a valid Stop message: " +
- in[0]);
+ {
+ throw new DataFormatException("input is not a valid Stop message: " + in[0]);
+ }
}
/** {@inheritDoc} */
@Override
public byte[] getBytes(short protocolVersion)
{
- return new byte[]
- {
- MSG_TYPE_STOP
- };
+ return new byte[] { MSG_TYPE_STOP };
}
/** {@inheritDoc} */
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/replication/server/DataServerHandler.java b/opendj-server-legacy/src/main/java/org/opends/server/replication/server/DataServerHandler.java
index f696b2a..096cecf 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/replication/server/DataServerHandler.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/replication/server/DataServerHandler.java
@@ -423,7 +423,9 @@
// The session initiator decides whether to use SSL.
// Until here session is encrypted then it depends on the negotiation
if (!sessionInitiatorSSLEncryption)
+ {
session.stopEncryption();
+ }
// wait and process StartSessionMsg from remote RS
StartSessionMsg inStartSessionMsg =
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/replication/server/LightweightServerHandler.java b/opendj-server-legacy/src/main/java/org/opends/server/replication/server/LightweightServerHandler.java
index 22687f6..46af9d2 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/replication/server/LightweightServerHandler.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/replication/server/LightweightServerHandler.java
@@ -80,7 +80,9 @@
this.dsInfo = dsInfo;
if (logger.isTraceEnabled())
+ {
debugInfo("()");
+ }
}
/**
@@ -108,7 +110,9 @@
public void startHandler()
{
if (logger.isTraceEnabled())
+ {
debugInfo("start");
+ }
DirectoryServer.deregisterMonitorProvider(this);
DirectoryServer.registerMonitorProvider(this);
}
@@ -119,7 +123,9 @@
public void stopHandler()
{
if (logger.isTraceEnabled())
+ {
debugInfo("stop");
+ }
DirectoryServer.deregisterMonitorProvider(this);
}
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/replication/server/ReplicationServerHandler.java b/opendj-server-legacy/src/main/java/org/opends/server/replication/server/ReplicationServerHandler.java
index 5a60554..56b5b58 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/replication/server/ReplicationServerHandler.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/replication/server/ReplicationServerHandler.java
@@ -208,7 +208,9 @@
// Until here session is encrypted then it depends on the negotiation
// The session initiator decides whether to use SSL.
if (!this.sslEncryption)
+ {
session.stopEncryption();
+ }
if (getProtocolVersion() > ProtocolVersion.REPLICATION_PROTOCOL_V1)
{
@@ -308,7 +310,9 @@
The session initiator decides whether to use SSL.
*/
if (!sslEncryption)
+ {
session.stopEncryption();
+ }
TopologyMsg inTopoMsg = null;
if (getProtocolVersion() > ProtocolVersion.REPLICATION_PROTOCOL_V1)
@@ -368,7 +372,9 @@
// Process TopologyMsg sent by remote RS: store matching new info
// (this will also warn our connected DSs of the new received info)
if (inTopoMsg!=null)
+ {
replicationServerDomain.receiveTopoInfoFromRS(inTopoMsg, this, false);
+ }
logger.debug(INFO_REPLICATION_SERVER_CONNECTION_FROM_RS, getReplicationServerId(), getServerId(),
replicationServerDomain.getBaseDN(), session.getReadableRemoteAddress());
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/replication/server/SafeDataExpectedAcksInfo.java b/opendj-server-legacy/src/main/java/org/opends/server/replication/server/SafeDataExpectedAcksInfo.java
index c0a672f..e6c792d 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/replication/server/SafeDataExpectedAcksInfo.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/replication/server/SafeDataExpectedAcksInfo.java
@@ -85,8 +85,10 @@
{
// Sanity check: this should never happen
if (logger.isTraceEnabled())
+ {
logger.trace("Received unexpected SD ack from DS id: "
+ ackingServer.getServerId() + " ack message: " + ackMsg);
+ }
return false;
}
@@ -97,8 +99,10 @@
{
// Sanity check: this should never happen
if (logger.isTraceEnabled())
+ {
logger.trace("Received unexpected ack from server id: " +
ackingServerId + " ack message: " + ackMsg);
+ }
return false;
} else
{
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 c6b11da..83e455f 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
@@ -161,9 +161,11 @@
{
// Sanity check: this should never happen
if (logger.isTraceEnabled())
+ {
logger.trace("Received unexpected ack from server id: "
+ ackingServerId + " ack message: " + ackMsg);
- return false;
+ }
+ return false;
} else
{
// Analyze received ack and update info for the ack to be later computed
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/replication/server/ServerHandler.java b/opendj-server-legacy/src/main/java/org/opends/server/replication/server/ServerHandler.java
index 344c367..d32ecdd 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/replication/server/ServerHandler.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/replication/server/ServerHandler.java
@@ -917,7 +917,9 @@
// don't try anymore to join and return.
}
if (logger.isTraceEnabled())
+ {
logger.trace("SH.shutdowned(" + this + ")");
+ }
}
/**
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/replication/server/ServerReader.java b/opendj-server-legacy/src/main/java/org/opends/server/replication/server/ServerReader.java
index 7291043..b4ce2b8 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/replication/server/ServerReader.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/replication/server/ServerReader.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.replication.server;
@@ -311,7 +311,8 @@
private void logException(Exception e)
{
if (logger.isTraceEnabled())
- logger.trace(
- "In " + getName() + " " + stackTraceToSingleLineString(e));
+ {
+ logger.trace("In " + getName() + " " + stackTraceToSingleLineString(e));
+ }
}
}
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/replication/service/ReplicationBroker.java b/opendj-server-legacy/src/main/java/org/opends/server/replication/service/ReplicationBroker.java
index 48456a0..ed2c87c 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/replication/service/ReplicationBroker.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/replication/service/ReplicationBroker.java
@@ -759,8 +759,9 @@
* out which one is the best to connect to.
*/
if (logger.isTraceEnabled())
- debugInfo("phase 1 : will perform PhaseOneH with each RS in order to "
- + "elect the preferred one");
+ {
+ debugInfo("phase 1 : will perform PhaseOneH with each RS in order to elect the preferred one");
+ }
// Get info from every available replication servers
Map<Integer, ReplicationServerInfo> rsInfos =
@@ -779,8 +780,9 @@
// Best found, now initialize connection to this one (handshake phase 1)
if (logger.isTraceEnabled())
- debugInfo("phase 2 : will perform PhaseOneH with the preferred RS="
- + evals.getBestRS());
+ {
+ debugInfo("phase 2 : will perform PhaseOneH with the preferred RS=" + evals.getBestRS());
+ }
final ConnectedRS electedRS = performPhaseOneHandshake(
evals.getBestRS().getServerURL(), true);
@@ -1584,7 +1586,9 @@
{
eval.accept(rsId, rsInfo);
if (!rsInfo.serverState.isEmpty())
+ {
emptyState = false;
+ }
}
else if (rsInfo.getGenerationId() == -1)
{
@@ -2548,8 +2552,9 @@
}
logger.info(message);
if (logger.isTraceEnabled())
- debugInfo("best replication servers evaluation results: "
- + evals);
+ {
+ debugInfo("best replication servers evaluation results: " + evals);
+ }
reStart(true);
}
@@ -2656,8 +2661,9 @@
public void stop()
{
if (logger.isTraceEnabled())
- debugInfo("is stopping and will close the connection to RS("
- + getRsServerId() + ")");
+ {
+ debugInfo("is stopping and will close the connection to RS(" + getRsServerId() + ")");
+ }
synchronized (startStopLock)
{
@@ -3204,7 +3210,9 @@
else
{
if (logger.isTraceEnabled())
+ {
debugInfo("is not configured to send CSN heartbeat interval");
+ }
}
}
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/replication/service/ReplicationDomain.java b/opendj-server-legacy/src/main/java/org/opends/server/replication/service/ReplicationDomain.java
index e7ba797..284d231 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/replication/service/ReplicationDomain.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/replication/service/ReplicationDomain.java
@@ -439,8 +439,10 @@
private void receiveChangeStatus(ChangeStatusMsg csMsg)
{
if (logger.isTraceEnabled())
+ {
logger.trace("Replication domain " + getBaseDN() +
" received change status message:\n" + csMsg);
+ }
ServerStatus reqStatus = csMsg.getRequestedStatus();
@@ -485,8 +487,9 @@
break;
default:
if (logger.isTraceEnabled())
- logger.trace("updateDomainForNewStatus: unexpected status: " +
- status);
+ {
+ logger.trace("updateDomainForNewStatus: unexpected status: " + status);
+ }
}
}
@@ -790,10 +793,12 @@
receiveEntryBytes() method.
*/
if (logger.isTraceEnabled())
+ {
logger.trace(
"[IE] processErrorMsg:" + getServerId() +
" baseDN: " + getBaseDN() +
" Error Msg received: " + errorMsg);
+ }
if (errorMsg.getCreationTime() > ieCtx.startTime)
{
@@ -1050,7 +1055,9 @@
public void run()
{
if (logger.isTraceEnabled())
+ {
logger.trace("[IE] starting " + getName());
+ }
try
{
initializeRemote(serverIdToInitialize, serverIdToInitialize, null,
@@ -1065,7 +1072,9 @@
}
if (logger.isTraceEnabled())
+ {
logger.trace("[IE] ending " + getName());
+ }
}
}
@@ -1305,7 +1314,9 @@
private void setAckVal(int serverId, int numAck)
{
if (logger.isTraceEnabled())
+ {
logger.trace("[IE] setAckVal[" + serverId + "]=" + numAck);
+ }
this.ackVals.put(serverId, numAck);
@@ -1329,8 +1340,10 @@
public int getSlowestServer()
{
if (logger.isTraceEnabled())
+ {
logger.trace("[IE] getSlowestServer" + slowestServerId
+ " " + this.ackVals.get(slowestServerId));
+ }
return this.slowestServerId;
}
@@ -1512,9 +1525,11 @@
}
if (logger.isTraceEnabled())
+ {
logger.trace("[IE] In " + broker.getReplicationMonitorInstanceName()
+ " export ends with connected=" + broker.isConnected()
+ " exportRootException=" + exportRootException);
+ }
if (exportRootException != null)
{
@@ -1534,8 +1549,9 @@
// We are still disconnected, so we wait for the listener thread
// to reconnect - wait 10s
if (logger.isTraceEnabled())
- logger.trace(
- "[IE] Exporter wait for reconnection by the listener thread");
+ {
+ logger.trace("[IE] Exporter wait for reconnection by the listener thread");
+ }
int att=0;
while (!broker.shuttingDown()
&& !broker.isConnected()
@@ -1626,8 +1642,9 @@
final Set<Integer> replicasWeAreWaitingFor = new HashSet<>(ieCtx.startList);
if (logger.isTraceEnabled())
- logger.trace(
- "[IE] wait for start replicasWeAreWaitingFor=" + replicasWeAreWaitingFor);
+ {
+ logger.trace("[IE] wait for start replicasWeAreWaitingFor=" + replicasWeAreWaitingFor);
+ }
int waitResultAttempt = 0;
boolean done;
@@ -1637,11 +1654,13 @@
for (DSInfo dsi : getReplicaInfos().values())
{
if (logger.isTraceEnabled())
+ {
logger.trace(
"[IE] wait for start dsId " + dsi.getDsId()
+ " " + dsi.getStatus()
+ " " + dsi.getGenerationId()
+ " " + getGenerationID());
+ }
if (ieCtx.startList.contains(dsi.getDsId()))
{
if (dsi.getStatus() != ServerStatus.FULL_UPDATE_STATUS)
@@ -1669,8 +1688,9 @@
ieCtx.failureList.addAll(replicasWeAreWaitingFor);
if (logger.isTraceEnabled())
- logger.trace(
- "[IE] wait for start ends with " + ieCtx.failureList);
+ {
+ logger.trace("[IE] wait for start ends with " + ieCtx.failureList);
+ }
}
/**
@@ -1683,8 +1703,9 @@
final Set<Integer> replicasWeAreWaitingFor = new HashSet<>(ieCtx.startList);
if (logger.isTraceEnabled())
- logger.trace(
- "[IE] wait for end replicasWeAreWaitingFor=" + replicasWeAreWaitingFor);
+ {
+ logger.trace("[IE] wait for end replicasWeAreWaitingFor=" + replicasWeAreWaitingFor);
+ }
/*
In case some new servers appear during the init, we want them to be
@@ -1759,8 +1780,9 @@
ieCtx.failureList.addAll(replicasWeAreWaitingFor);
if (logger.isTraceEnabled())
- logger.trace(
- "[IE] wait for end ends with " + ieCtx.failureList);
+ {
+ logger.trace("[IE] wait for end ends with " + ieCtx.failureList);
+ }
}
/**
@@ -2005,8 +2027,9 @@
throws IOException
{
if (logger.isTraceEnabled())
- logger.trace("[IE] Entering exportLDIFEntry entry=" +
- Arrays.toString(lDIFEntry));
+ {
+ logger.trace("[IE] Entering exportLDIFEntry entry=" + Arrays.toString(lDIFEntry));
+ }
// build the message
ImportExportContext ieCtx = importExportContext.get();
@@ -2041,13 +2064,17 @@
int slowestCnt = ieCtx.ackVals.get(slowestServerId);
if (logger.isTraceEnabled())
+ {
logger.trace("[IE] Entering exportLDIFEntry waiting " +
" our=" + ourLastExportedCnt + " slowest=" + slowestCnt);
+ }
if ((ourLastExportedCnt - slowestCnt) > ieCtx.initWindow)
{
if (logger.isTraceEnabled())
+ {
logger.trace("[IE] Entering exportLDIFEntry waiting");
+ }
// our export is too far beyond the slowest importer - let's wait
try { Thread.sleep(100); }
@@ -2068,14 +2095,17 @@
else
{
if (logger.isTraceEnabled())
+ {
logger.trace("[IE] slowest got to us => stop waiting");
+ }
break;
}
} // Waiting the slowest loop
if (logger.isTraceEnabled())
- logger.trace("[IE] Entering exportLDIFEntry pub entry="
- + Arrays.toString(lDIFEntry));
+ {
+ logger.trace("[IE] Entering exportLDIFEntry pub entry=" + Arrays.toString(lDIFEntry));
+ }
boolean sent = broker.publish(entryMessage, false);
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/tools/ImportLDIF.java b/opendj-server-legacy/src/main/java/org/opends/server/tools/ImportLDIF.java
index bfaf117..620e236 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/tools/ImportLDIF.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/tools/ImportLDIF.java
@@ -1062,7 +1062,10 @@
badFileCount++;
}
}
- if (badFileCount > 0) return 1;
+ if (badFileCount > 0)
+ {
+ return 1;
+ }
importConfig = new LDIFImportConfig(fileList);
}
else
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/tools/LDIFSearch.java b/opendj-server-legacy/src/main/java/org/opends/server/tools/LDIFSearch.java
index 3c6a62e..f370e47 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/tools/LDIFSearch.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/tools/LDIFSearch.java
@@ -383,12 +383,16 @@
//Single '+', never return objectclass.
if(allOperationalAttrs && objectClassNames.isEmpty() &&
attributeNames.isEmpty())
+ {
includeObjectclassAttrs=false;
+ }
//If "objectclass" isn't specified in the attributes to return, then
//don't include objectclass attribute.
if(!attributeNames.isEmpty() && objectClassNames.isEmpty() &&
!attributeNames.contains("objectclass"))
- includeObjectclassAttrs=false;
+ {
+ includeObjectclassAttrs=false;
+ }
}
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/tools/ManageTasks.java b/opendj-server-legacy/src/main/java/org/opends/server/tools/ManageTasks.java
index 14e4f20..8489327 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/tools/ManageTasks.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/tools/ManageTasks.java
@@ -324,14 +324,20 @@
getOutputStream().println();
MenuResult<TaskEntry> r =
new PrintTaskInfo(task.getValue()).invoke(this);
- if (r.isAgain()) return 1;
+ if (r.isAgain())
+ {
+ return 1;
+ }
} else if (summary.isPresent()) {
getOutputStream().println();
printSummaryTable();
} else if (cancel.isPresent()) {
MenuResult<TaskEntry> r =
new CancelTask(cancel.getValue()).invoke(this);
- if (r.isAgain()) return 1;
+ if (r.isAgain())
+ {
+ return 1;
+ }
} else if (!isInteractive()) {
// no-prompt option
getOutputStream().println();
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/tools/tasks/TaskTool.java b/opendj-server-legacy/src/main/java/org/opends/server/tools/tasks/TaskTool.java
index feb8e99..e46f5db 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/tools/tasks/TaskTool.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/tools/tasks/TaskTool.java
@@ -352,23 +352,38 @@
} else {
message = ERR_TASK_TOOL_START_TIME_NO_LDAP.get(e.getMessage());
}
- if (err != null) err.println(wrapText(message, MAX_LINE_WIDTH));
+ if (err != null)
+ {
+ err.println(wrapText(message, MAX_LINE_WIDTH));
+ }
ret = 1;
} catch (DecodeException ae) {
LocalizableMessage message = ERR_TASK_TOOL_DECODE_ERROR.get(ae.getMessage());
- if (err != null) err.println(wrapText(message, MAX_LINE_WIDTH));
+ if (err != null)
+ {
+ err.println(wrapText(message, MAX_LINE_WIDTH));
+ }
ret = 1;
} catch (IOException ioe) {
LocalizableMessage message = ERR_TASK_TOOL_IO_ERROR.get(ioe);
- if (err != null) err.println(wrapText(message, MAX_LINE_WIDTH));
+ if (err != null)
+ {
+ err.println(wrapText(message, MAX_LINE_WIDTH));
+ }
ret = 1;
} catch (LDAPException le) {
LocalizableMessage message = ERR_TASK_TOOL_LDAP_ERROR.get(le.getMessage());
- if (err != null) err.println(wrapText(message, MAX_LINE_WIDTH));
+ if (err != null)
+ {
+ err.println(wrapText(message, MAX_LINE_WIDTH));
+ }
ret = 1;
} catch (ArgumentException | OpenDsException e) {
LocalizableMessage message = e.getMessageObject();
- if (err != null) err.println(wrapText(message, MAX_LINE_WIDTH));
+ if (err != null)
+ {
+ err.println(wrapText(message, MAX_LINE_WIDTH));
+ }
ret = 1;
} finally
{
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/types/HostPort.java b/opendj-server-legacy/src/main/java/org/opends/server/types/HostPort.java
index dd418c4..68ac27c 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/types/HostPort.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/types/HostPort.java
@@ -498,20 +498,30 @@
public boolean equals(Object obj)
{
if (obj == null)
+ {
return false;
+ }
if (obj == this)
+ {
return true;
+ }
if (getClass() != obj.getClass())
+ {
return false;
+ }
HostPort other = (HostPort) obj;
if (normalizedHost == null)
{
if (other.normalizedHost != null)
+ {
return false;
+ }
}
else if (!normalizedHost.equals(other.normalizedHost))
+ {
return false;
+ }
return port == other.port;
}
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/util/CertificateManager.java b/opendj-server-legacy/src/main/java/org/opends/server/util/CertificateManager.java
index 9ca045f..d032362 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/util/CertificateManager.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/util/CertificateManager.java
@@ -204,13 +204,19 @@
Enumeration<String> aliasEnumeration = null;
KeyStore keyStore = getKeyStore();
if (keyStore == null)
+ {
return null;
+ }
aliasEnumeration = keyStore.aliases();
if (aliasEnumeration == null)
+ {
return new String[0];
+ }
ArrayList<String> aliasList = new ArrayList<>();
while (aliasEnumeration.hasMoreElements())
+ {
aliasList.add(aliasEnumeration.nextElement());
+ }
String[] aliases = new String[aliasList.size()];
return aliasList.toArray(aliases);
}
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/util/Crypt.java b/opendj-server-legacy/src/main/java/org/opends/server/util/Crypt.java
index 48bb60a..d29b9f3 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/util/Crypt.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/util/Crypt.java
@@ -290,9 +290,13 @@
int a = IP[j] - 1;
int b = block[a];
if (j <= 31)
+ {
_c._L[j] = b;
+ }
else
+ {
_c._R[j - 32] = b;
+ }
}
/*
* Perform an encryption operation 16 times.
@@ -320,7 +324,9 @@
* key bits.
*/
for (int j = 0; j < 48; j++)
+ {
_c._preS[j] = _c._R[_c._E[j] - 1] ^ _c._KS[i][j];
+ }
/*
* The pre-select bits are now considered in 8 groups of 6 bits each. The
* 8 selection functions map these 6-bit quantities into 4-bit quantities
@@ -344,7 +350,9 @@
* The new R is L ^ f(R, K). The f here has to be permuted first, though.
*/
for (int j = 0; j < 32; j++)
+ {
_c._R[j] = _c._L[j] ^ _c._f[P[j] - 1];
+ }
/*
* Finally, the new L (the original R) is copied back.
*/
@@ -426,7 +434,9 @@
{
int c = pw[n];
for (int j = 0; j < 7; j++, i++)
+ {
_c._ablock[i] = (c >> (6 - j)) & 01;
+ }
i++;
}
@@ -440,8 +450,14 @@
{
int c = salt[i];
_c._iobuf[i] = c;
- if (c > 'Z') c -= 6;
- if (c > '9') c -= 7;
+ if (c > 'Z')
+ {
+ c -= 6;
+ }
+ if (c > '9')
+ {
+ c -= 7;
+ }
c -= '.';
for (int j = 0; j < 6; j++)
{
@@ -455,7 +471,9 @@
}
for (int i = 0; i < 25; i++)
+ {
encrypt(_c._ablock, 0);
+ }
int i;
for (i = 0; i < 11; i++)
@@ -467,12 +485,21 @@
c |= _c._ablock[6 * i + j];
}
c += '.';
- if (c > '9') c += 7;
- if (c > 'Z') c += 6;
+ if (c > '9')
+ {
+ c += 7;
+ }
+ if (c > 'Z')
+ {
+ c += 6;
+ }
_c._iobuf[i + 2] = c;
}
_c._iobuf[i + 2] = 0;
- if (_c._iobuf[1] == 0) _c._iobuf[1] = _c._iobuf[0];
+ if (_c._iobuf[1] == 0)
+ {
+ _c._iobuf[1] = _c._iobuf[0];
+ }
return (_c._iobuf);
}
}
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/util/Platform.java b/opendj-server-legacy/src/main/java/org/opends/server/util/Platform.java
index e9bf101..1322bd0 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/util/Platform.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/util/Platform.java
@@ -208,7 +208,9 @@
else if (!ks.containsAlias(alias)
|| ks
.entryInstanceOf(alias, KeyStore.TrustedCertificateEntry.class))
+ {
trustedCert(alias, cf, ks, inStream);
+ }
else
{
LocalizableMessage msg = ERR_CERTMGR_ALIAS_INVALID.get(alias);
@@ -291,7 +293,10 @@
throw new KeyStoreException(msg.toString());
}
X509Certificate cert = (X509Certificate) cf.generateCertificate(in);
- if (isSelfSigned(cert)) cert.verify(cert.getPublicKey());
+ if (isSelfSigned(cert))
+ {
+ cert.verify(cert.getPublicKey());
+ }
ks.setCertificateEntry(alias, cert);
}
catch (Exception e)
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 a28c6ae..1adfa25 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
@@ -121,7 +121,10 @@
*/
public static byte[] getBytes(String s)
{
- if (s == null) return null;
+ if (s == null)
+ {
+ return null;
+ }
try
{
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/util/VersionCompatibilityIssue.java b/opendj-server-legacy/src/main/java/org/opends/server/util/VersionCompatibilityIssue.java
index b7844a7..5c7cf02 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/util/VersionCompatibilityIssue.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/util/VersionCompatibilityIssue.java
@@ -541,7 +541,10 @@
Collection<Integer> excludeIds, BuildInformation current,
BuildInformation neu)
{
- if (excludeIds == null) excludeIds = Collections.emptySet();
+ if (excludeIds == null)
+ {
+ excludeIds = Collections.emptySet();
+ }
List<VersionCompatibilityIssue> issueList = new ArrayList<>();
for (VersionCompatibilityIssue evt : VERSION_COMPATIBILITY_ISSUES) {
if (!excludeIds.contains(evt.getCause().getId())) {
diff --git a/opendj-server-legacy/src/main/resources/org/forgerock/checkstyle/opends-checkstyle.xml b/opendj-server-legacy/src/main/resources/org/forgerock/checkstyle/opends-checkstyle.xml
index 9d92f47..2c397f3 100644
--- a/opendj-server-legacy/src/main/resources/org/forgerock/checkstyle/opends-checkstyle.xml
+++ b/opendj-server-legacy/src/main/resources/org/forgerock/checkstyle/opends-checkstyle.xml
@@ -1,4 +1,19 @@
<?xml version="1.0"?>
+<!--
+ The contents of this file are subject to the terms of the Common Development and
+ Distribution License (the License). You may not use this file except in compliance with the
+ License.
+
+ You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the
+ specific language governing permission and limitations under the License.
+
+ When distributing Covered Software, include this CDDL Header Notice in each file and include
+ the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL
+ Header, with the fields enclosed by brackets [] replaced by your own identifying
+ information: "Portions Copyrighted [year] [name of copyright owner]".
+
+ Copyright 2012-2015 ForgeRock AS. All rights reserved.
+-->
<!DOCTYPE module PUBLIC
"-//Puppy Crawl//DTD Check Configuration 1.2//EN"
"http://www.puppycrawl.com/dtds/configuration_1_2.dtd">
@@ -89,6 +104,9 @@
</module>
+ <!-- As per Sun conventions -->
+ <!-- Use braces for with all control flow statements -->
+ <module name="NeedBraces" />
<!-- Don't allow empty statements (those that contain just a semicolon) -->
<module name="EmptyStatement" />
</module>
diff --git a/opendj-server-legacy/src/test/java/org/opends/quicksetup/TestUtilities.java b/opendj-server-legacy/src/test/java/org/opends/quicksetup/TestUtilities.java
index 2088dc9..dffff68 100644
--- a/opendj-server-legacy/src/test/java/org/opends/quicksetup/TestUtilities.java
+++ b/opendj-server-legacy/src/test/java/org/opends/quicksetup/TestUtilities.java
@@ -99,8 +99,8 @@
if (p.waitFor() != 0) {
ByteStringBuilder stdOut = new ByteStringBuilder();
ByteStringBuilder stdErr = new ByteStringBuilder();
- while(stdOut.append(p.getInputStream(), 512) > 0);
- while(stdErr.append(p.getErrorStream(), 512) > 0);
+ while(stdOut.append(p.getInputStream(), 512) > 0) {}
+ while(stdErr.append(p.getErrorStream(), 512) > 0) {}
throw new IllegalStateException(
"setup server process failed:\n" +
"exit value: " + p.exitValue() + "\n" +
diff --git a/opendj-server-legacy/src/test/java/org/opends/quicksetup/util/FileManagerTest.java b/opendj-server-legacy/src/test/java/org/opends/quicksetup/util/FileManagerTest.java
index 4d1b48c..559a6f2 100644
--- a/opendj-server-legacy/src/test/java/org/opends/quicksetup/util/FileManagerTest.java
+++ b/opendj-server-legacy/src/test/java/org/opends/quicksetup/util/FileManagerTest.java
@@ -568,7 +568,10 @@
}
private void writeContents(File f, String content) throws IOException {
- if (!f.exists()) f.createNewFile();
+ if (!f.exists())
+ {
+ f.createNewFile();
+ }
FileWriter fw = new FileWriter(f);
fw.write(content);
fw.flush();
diff --git a/opendj-server-legacy/src/test/java/org/opends/server/authorization/dseecompat/AciTestCase.java b/opendj-server-legacy/src/test/java/org/opends/server/authorization/dseecompat/AciTestCase.java
index 2d5167e..2626c3b 100644
--- a/opendj-server-legacy/src/test/java/org/opends/server/authorization/dseecompat/AciTestCase.java
+++ b/opendj-server-legacy/src/test/java/org/opends/server/authorization/dseecompat/AciTestCase.java
@@ -230,7 +230,9 @@
argList.add(filter);
String[] attrs=attr.split("\\s+");
for(String a : attrs)
- argList.add(a);
+ {
+ argList.add(a);
+ }
String[] args = new String[argList.size()];
oStream.reset();
int retVal =
@@ -299,14 +301,11 @@
argList.add("sub");
argList.add(filter);
if(attr != null) {
- String[] attrs=attr.split("\\s+");
- for(String a : attrs)
- argList.add(a);
+ Collections.addAll(argList, attr.split("\\s+"));
}
String[] args = new String[argList.size()];
oStream.reset();
- int retVal =
- LDAPSearch.mainSearch(argList.toArray(args), false, oStream, oStream);
+ int retVal = LDAPSearch.mainSearch(argList.toArray(args), false, oStream, oStream);
Assert.assertEquals(retVal, expectedRc, "Returned error: " + oStream);
return oStream.toString();
}
@@ -320,8 +319,7 @@
protected void LDIFModify(String ldif, String bindDn, String bindPassword,
String controlStr, int expectedRc) throws Exception
{
- _LDIFModify(ldif, bindDn, bindPassword, controlStr, false, expectedRc,
- false);
+ _LDIFModify(ldif, bindDn, bindPassword, controlStr, false, expectedRc, false);
}
protected void LDIFModify(String ldif, String bindDn, String bindPassword)
@@ -462,7 +460,9 @@
oStream.reset();
int retVal =LDAPModify.mainModify(args, false, oStream, oStream);
if (expectedRc != -1)
+ {
Assert.assertEquals(retVal, expectedRc, "Returned error: " + oStream);
+ }
}
protected void deleteAttrFromEntry(String dn, String attr) throws Exception {
@@ -493,7 +493,9 @@
ldif.append("newrdn: ").append(newRDN).append(EOL);
ldif.append("deleteoldrdn: ").append(deleteOldRDN).append(EOL);
if(newSuperior != null)
- ldif.append("newsuperior: ").append(newSuperior).append(EOL);
+ {
+ ldif.append("newsuperior: ").append(newSuperior).append(EOL);
+ }
ldif.append(EOL);
return ldif.toString();
}
@@ -504,7 +506,9 @@
ldif.append("changetype: modify").append(EOL);
ldif.append("delete: ").append(attr).append(EOL);
for(String aci : acis)
+ {
ldif.append(attr).append(":").append(aci).append(EOL);
+ }
ldif.append(EOL);
return ldif.toString();
}
@@ -514,7 +518,9 @@
ldif.append("dn: ").append(dn).append(EOL);
ldif.append("changetype: add").append(EOL);
for(String l : lines)
- ldif.append(l).append(EOL);
+ {
+ ldif.append(l).append(EOL);
+ }
ldif.append(EOL);
return ldif.toString();
}
@@ -525,7 +531,9 @@
ldif.append("changetype: modify").append(EOL);
ldif.append("add: ").append(attr).append(EOL);
for(String aci : acis)
+ {
ldif.append(attr).append(":").append(aci).append(EOL);
+ }
ldif.append(EOL);
return ldif.toString();
}
@@ -725,12 +733,18 @@
while(true) {
String s = br.readLine();
if(s == null)
+ {
break;
+ }
if(s.startsWith("dn:"))
+ {
continue;
+ }
String[] a=s.split(": ");
if(a.length != 2)
+ {
break;
+ }
attrMap.put(a[0].toLowerCase(),a[1]);
}
} catch (IOException e) {
diff --git a/opendj-server-legacy/src/test/java/org/opends/server/authorization/dseecompat/AciTests.java b/opendj-server-legacy/src/test/java/org/opends/server/authorization/dseecompat/AciTests.java
index de3c11b..13aa564 100644
--- a/opendj-server-legacy/src/test/java/org/opends/server/authorization/dseecompat/AciTests.java
+++ b/opendj-server-legacy/src/test/java/org/opends/server/authorization/dseecompat/AciTests.java
@@ -2245,7 +2245,9 @@
ldif.append("changetype: modify").append(EOL);
ldif.append("add: " + attr).append(EOL);
for(String aci : acis)
- ldif.append(aci).append(EOL);
+ {
+ ldif.append(aci).append(EOL);
+ }
ldif.append(EOL);
return ldif.toString();
}
@@ -2342,7 +2344,9 @@
argList.add("-f");
argList.add(tempFile.getAbsolutePath());
if(contFlag)
- argList.add("-c");
+ {
+ argList.add("-c");
+ }
if(proxyDN != null) {
argList.add("-Y");
argList.add("dn:" + proxyDN);
@@ -2376,7 +2380,9 @@
ldif.append("newrdn: " + newRDN).append(EOL);
ldif.append("deleteoldrdn: " + deleteOldRDN).append(EOL);
if(newSuperior != null)
- ldif.append("newsuperior: " + newSuperior).append(EOL);
+ {
+ ldif.append("newsuperior: " + newSuperior).append(EOL);
+ }
ldif.append(EOL);
return ldif.toString();
}
@@ -2535,11 +2541,17 @@
ldif.append("userpassword: ").append(password).append(EOL);
for(String attr : attrs) {
if(attr.startsWith("ldap://"))
- ldif.append("labeledURI: ").append(attr).append(EOL);
+ {
+ ldif.append("labeledURI: ").append(attr).append(EOL);
+ }
else if(attr.startsWith("cn=group"))
- ldif.append("seeAlso: ").append(attr).append(EOL);
+ {
+ ldif.append("seeAlso: ").append(attr).append(EOL);
+ }
else
- ldif.append("manager: ").append(attr).append(EOL);
+ {
+ ldif.append("manager: ").append(attr).append(EOL);
+ }
}
ldif.append(EOL);
return ldif.toString();
@@ -2558,7 +2570,9 @@
ldif.append("objectclass: groupOfNames").append(EOL);
ldif.append("objectclass: top").append(EOL);
for(String member : members)
- ldif.append("member: " + member).append(EOL);
+ {
+ ldif.append("member: " + member).append(EOL);
+ }
ldif.append(EOL);
return ldif.toString();
}
diff --git a/opendj-server-legacy/src/test/java/org/opends/server/authorization/dseecompat/IPTestCase.java b/opendj-server-legacy/src/test/java/org/opends/server/authorization/dseecompat/IPTestCase.java
index 0b34b66..067c21b 100644
--- a/opendj-server-legacy/src/test/java/org/opends/server/authorization/dseecompat/IPTestCase.java
+++ b/opendj-server-legacy/src/test/java/org/opends/server/authorization/dseecompat/IPTestCase.java
@@ -181,8 +181,9 @@
InetAddress addr=InetAddress.getByName(ipStr);
EnumEvalResult res=ip.evaluate(addr);
if(res != EnumEvalResult.TRUE)
- throw new RuntimeException ("Addr: " + ipStr +
- "expr: " + mixed);
+ {
+ throw new RuntimeException ("Addr: " + ipStr + "expr: " + mixed);
+ }
}
@@ -198,8 +199,9 @@
InetAddress addr=InetAddress.getByName(ipStr);
EnumEvalResult res=ip.evaluate(addr);
if(res != EnumEvalResult.TRUE)
- throw new RuntimeException ("Addr: " + ipStr +
- "expr: " + ip4compat);
+ {
+ throw new RuntimeException ("Addr: " + ipStr + "expr: " + ip4compat);
+ }
}
/**
@@ -215,13 +217,15 @@
InetAddress addr=InetAddress.getByName(ipStr);
EnumEvalResult res=ip.evaluate(addr);
if(res != EnumEvalResult.TRUE)
- throw new RuntimeException ("Addr: " + ipStr +
- "expr: " + ip6ExprCidr);
+ {
+ throw new RuntimeException ("Addr: " + ipStr + "expr: " + ip6ExprCidr);
+ }
IP ip1=(IP) IP.decode(ip6ExprCidrB, EnumBindRuleType.EQUAL_BINDRULE_TYPE);
EnumEvalResult res1=ip1.evaluate(addr);
if(res1 != EnumEvalResult.TRUE)
- throw new RuntimeException ("Addr: " + ipStr +
- "expr: " + ip6ExprCidrB);
+ {
+ throw new RuntimeException ("Addr: " + ipStr + "expr: " + ip6ExprCidrB);
+ }
}
/**
@@ -238,13 +242,15 @@
InetAddress addr=InetAddress.getByName(ipStr);
EnumEvalResult res=ip.evaluate(addr);
if(res != EnumEvalResult.TRUE)
- throw new RuntimeException ("Addr: " + ipStr +
- "expr: " + ip6Expr);
+ {
+ throw new RuntimeException ("Addr: " + ipStr + "expr: " + ip6Expr);
+ }
IP ip1=(IP) IP.decode(ip6ExprC, EnumBindRuleType.EQUAL_BINDRULE_TYPE);
EnumEvalResult res1=ip1.evaluate(addr);
if(res1 != EnumEvalResult.TRUE)
- throw new RuntimeException ("Addr: " + ipStr +
- "expr: " + ip6ExprC);
+ {
+ throw new RuntimeException ("Addr: " + ipStr + "expr: " + ip6ExprC);
+ }
}
/**
@@ -260,14 +266,16 @@
InetAddress addr=InetAddress.getByName(ipStr);
EnumEvalResult res=ip.evaluate(addr);
if(res != EnumEvalResult.TRUE)
- throw new RuntimeException ("Addr: " + ipStr +
- "expr: " + cidr);
+ {
+ throw new RuntimeException ("Addr: " + ipStr + "expr: " + cidr);
+ }
IP ip1=(IP) IP.decode(cidrWc, EnumBindRuleType.EQUAL_BINDRULE_TYPE);
EnumEvalResult res1=ip.evaluate(addr);
if(res1 != EnumEvalResult.TRUE)
- throw new RuntimeException ("Addr: " + ipStr +
- "expr: " + cidrWc);
+ {
+ throw new RuntimeException ("Addr: " + ipStr + "expr: " + cidrWc);
+ }
}
/**
@@ -283,14 +291,16 @@
InetAddress addr=InetAddress.getByName(ipStr);
EnumEvalResult res=ip.evaluate(addr);
if(res != EnumEvalResult.TRUE)
- throw new RuntimeException ("Addr: " + ipStr +
- "expr: " + netmaskWc);
+ {
+ throw new RuntimeException ("Addr: " + ipStr + "expr: " + netmaskWc);
+ }
IP ip1 = (IP) IP.decode(netmaskWcOverRide,
EnumBindRuleType.EQUAL_BINDRULE_TYPE);
EnumEvalResult res1=ip1.evaluate(addr);
if(res1 != EnumEvalResult.TRUE)
- throw new RuntimeException ("Addr: " + ipStr +
- "expr: " + netmaskWc);
+ {
+ throw new RuntimeException ("Addr: " + ipStr + "expr: " + netmaskWc);
+ }
}
/**
@@ -306,13 +316,15 @@
InetAddress addr=InetAddress.getByName(ipStr);
EnumEvalResult res=ip.evaluate(addr);
if(res != EnumEvalResult.TRUE)
- throw new RuntimeException ("Addr: " + ipStr +
- "expr: " + ipExpr);
+ {
+ throw new RuntimeException ("Addr: " + ipStr + "expr: " + ipExpr);
+ }
IP ipWc=(IP) IP.decode(ipExprWc, EnumBindRuleType.EQUAL_BINDRULE_TYPE);
EnumEvalResult resWc=ipWc.evaluate(addr);
if(resWc != EnumEvalResult.TRUE)
- throw new RuntimeException ("Addr: " + ipStr +
- "expr:" + ipExprWc);
+ {
+ throw new RuntimeException ("Addr: " + ipStr + "expr:" + ipExprWc);
+ }
}
/**
diff --git a/opendj-server-legacy/src/test/java/org/opends/server/authorization/dseecompat/ReferencesTestCase.java b/opendj-server-legacy/src/test/java/org/opends/server/authorization/dseecompat/ReferencesTestCase.java
index fb0fd89..396d353 100644
--- a/opendj-server-legacy/src/test/java/org/opends/server/authorization/dseecompat/ReferencesTestCase.java
+++ b/opendj-server-legacy/src/test/java/org/opends/server/authorization/dseecompat/ReferencesTestCase.java
@@ -189,24 +189,23 @@
* @param resultString The string containing the results from the search.
* @return True if the "SearchReference" string is seen in the results.
*/
- protected boolean
- isRefMap(String resultString) {
- boolean ret=false;
+ protected boolean isRefMap(String resultString) {
StringReader r=new StringReader(resultString);
BufferedReader br=new BufferedReader(r);
try {
while(true) {
String s = br.readLine();
if(s == null)
+ {
break;
+ }
if(s.startsWith("SearchReference")) {
- ret=true;
- break;
+ return true;
}
}
} catch (IOException e) {
Assert.assertEquals(0, 1, e.getMessage());
}
- return ret;
+ return false;
}
}
diff --git a/opendj-server-legacy/src/test/java/org/opends/server/controls/MatchedValuesControlTest.java b/opendj-server-legacy/src/test/java/org/opends/server/controls/MatchedValuesControlTest.java
index aa55247..2915b01 100644
--- a/opendj-server-legacy/src/test/java/org/opends/server/controls/MatchedValuesControlTest.java
+++ b/opendj-server-legacy/src/test/java/org/opends/server/controls/MatchedValuesControlTest.java
@@ -227,11 +227,21 @@
subInitialTestCurrent = null;
subAnyTestCurrent = null;
subFinalTestCurrent = null;
- if ((i & 0x8) != 0) attTypeCurrent = attTypeTest;
- if ((i & 0x8) != 0) rawAttTypeTestCurrent = rawAttTypeTest;
- if ((i & 0x4) != 0) subInitialTestCurrent = subInitialTest;
- if ((i & 0x2) != 0) subAnyTestCurrent = subAnyTest;
- if ((i & 0x1) != 0) subFinalTestCurrent = subFinalTest;
+ if ((i & 0x8) != 0) {
+ attTypeCurrent = attTypeTest;
+ }
+ if ((i & 0x8) != 0) {
+ rawAttTypeTestCurrent = rawAttTypeTest;
+ }
+ if ((i & 0x4) != 0) {
+ subInitialTestCurrent = subInitialTest;
+ }
+ if ((i & 0x2) != 0) {
+ subAnyTestCurrent = subAnyTest;
+ }
+ if ((i & 0x1) != 0) {
+ subFinalTestCurrent = subFinalTest;
+ }
if (attTypeCurrent == null)
{
@@ -716,11 +726,21 @@
attTypeTestCurrent = null;
attValueTestCurrent = null ;
- if ((i & 0x4) != 0) attTypeTestCurrent = attTypeTest;
- if ((i & 0x4) != 0) rawAttTypeTestCurrent = rawAttTypeTest;
- if ((i & 0x2) != 0) rawMatchingRuleidTestCurrent = matchingRuleIdTest;
- if ((i & 0x2) != 0) matchingRuleidTestCurrent = matchingRule ;
- if ((i & 0x1) != 0) attValueTestCurrent = attValueTest;
+ if ((i & 0x4) != 0) {
+ attTypeTestCurrent = attTypeTest;
+ }
+ if ((i & 0x4) != 0) {
+ rawAttTypeTestCurrent = rawAttTypeTest;
+ }
+ if ((i & 0x2) != 0) {
+ rawMatchingRuleidTestCurrent = matchingRuleIdTest;
+ }
+ if ((i & 0x2) != 0) {
+ matchingRuleidTestCurrent = matchingRule ;
+ }
+ if ((i & 0x1) != 0) {
+ attValueTestCurrent = attValueTest;
+ }
boolean exceptionExpected = (attTypeTestCurrent == null)
|| (attValueTestCurrent == null) || (matchingRuleidTestCurrent == null);
diff --git a/opendj-server-legacy/src/test/java/org/opends/server/controls/PasswordControlTest.java b/opendj-server-legacy/src/test/java/org/opends/server/controls/PasswordControlTest.java
index 241ff0c..2196a7c 100644
--- a/opendj-server-legacy/src/test/java/org/opends/server/controls/PasswordControlTest.java
+++ b/opendj-server-legacy/src/test/java/org/opends/server/controls/PasswordControlTest.java
@@ -115,8 +115,10 @@
Set<Integer> keys = exceptedValues.keySet() ;
for (int i=-10 ; i< 10 ; i++)
{
- if (keys.contains(i)) continue ;
- assertNull(PasswordPolicyErrorType.valueOf(i));
+ if (!keys.contains(i))
+ {
+ assertNull(PasswordPolicyErrorType.valueOf(i));
+ }
}
}
diff --git a/opendj-server-legacy/src/test/java/org/opends/server/controls/PersistentSearchControlTest.java b/opendj-server-legacy/src/test/java/org/opends/server/controls/PersistentSearchControlTest.java
index efb9feb..3daa586 100644
--- a/opendj-server-legacy/src/test/java/org/opends/server/controls/PersistentSearchControlTest.java
+++ b/opendj-server-legacy/src/test/java/org/opends/server/controls/PersistentSearchControlTest.java
@@ -129,7 +129,10 @@
Set<Integer> keys = exceptedValues.keySet() ;
for (int i=-10 ; i< 10 ; i++)
{
- if (keys.contains(i)) continue ;
+ if (keys.contains(i))
+ {
+ continue;
+ }
try
{
PersistentSearchChangeType.valueOf(i);
diff --git a/opendj-server-legacy/src/test/java/org/opends/server/core/RejectUnauthReqTests.java b/opendj-server-legacy/src/test/java/org/opends/server/core/RejectUnauthReqTests.java
index fc0a780..5dc708f 100644
--- a/opendj-server-legacy/src/test/java/org/opends/server/core/RejectUnauthReqTests.java
+++ b/opendj-server-legacy/src/test/java/org/opends/server/core/RejectUnauthReqTests.java
@@ -76,6 +76,7 @@
"description: Reject Test Case");
String[] args = null;
if (authentication)
+ {
args = new String[]
{
"--noPropertiesFile",
@@ -91,7 +92,9 @@
"-f",
filePath,
};
+ }
else
+ {
args = new String[]
{
"--noPropertiesFile",
@@ -103,6 +106,7 @@
"-f",
filePath,
};
+ }
return LDAPModify.mainModify(args, false, null, null);
}
@@ -125,6 +129,7 @@
"description: New Description");
String[] args = null;
if (authentication)
+ {
args = new String[]
{
"--noPropertiesFile",
@@ -139,7 +144,9 @@
"-f",
path
};
+ }
else
+ {
args = new String[]
{
"--noPropertiesFile",
@@ -150,6 +157,7 @@
"-f",
path
};
+ }
return LDAPModify.mainModify(args, false, null, null);
}
@@ -169,6 +177,7 @@
{
String[] args = null;
if (authentication)
+ {
args = new String[]
{
"--noPropertiesFile",
@@ -183,7 +192,9 @@
"o:test",
"o=test"
};
+ }
else
+ {
args = new String[]
{
"--noPropertiesFile",
@@ -194,6 +205,7 @@
"o:test",
"o=test"
};
+ }
return LDAPCompare.mainCompare(args, false, null, null);
}
@@ -217,6 +229,7 @@
"newrdn: o=mod_rejectTestCase", "deleteoldrdn: 0");
String[] args = null;
if (authentication)
+ {
args = new String[]
{
"--noPropertiesFile",
@@ -231,7 +244,9 @@
"-f",
path
};
+ }
else
+ {
args = new String[]
{
"--noPropertiesFile",
@@ -242,6 +257,7 @@
"-f",
path
};
+ }
return LDAPModify.mainModify(args, false, null, null);
}
@@ -261,6 +277,7 @@
{
String[] args = null;
if (authentication)
+ {
args = new String[]
{
"--noPropertiesFile",
@@ -276,7 +293,9 @@
"password",
"o=mod_rejectTestCase,o=test"
};
+ }
else
+ {
args = new String[]
{
"--noPropertiesFile",
@@ -286,6 +305,7 @@
String.valueOf(TestCaseUtils.getServerLdapPort()),
"o=mod_rejectTestCase,o=test"
};
+ }
return LDAPDelete.mainDelete(args, false, null, null);
}
diff --git a/opendj-server-legacy/src/test/java/org/opends/server/extensions/SASLOverTLSTestCase.java b/opendj-server-legacy/src/test/java/org/opends/server/extensions/SASLOverTLSTestCase.java
index 8160a1f..afe65e4 100644
--- a/opendj-server-legacy/src/test/java/org/opends/server/extensions/SASLOverTLSTestCase.java
+++ b/opendj-server-legacy/src/test/java/org/opends/server/extensions/SASLOverTLSTestCase.java
@@ -273,7 +273,9 @@
Assert.assertTrue(Arrays.equals(jpegBytes, jpegBytes1));
} finally {
if(ctx != null)
+ {
ctx.close();
+ }
}
}
@@ -313,7 +315,9 @@
Assert.assertTrue(Arrays.equals(jpegBytes, jpegBytes1));
} finally {
if(ctx != null)
+ {
ctx.close();
+ }
}
}
@@ -357,7 +361,9 @@
ctx.modifyAttributes(testUserDN, mods);
} finally {
if (ctx != null)
+ {
ctx.close();
+ }
}
}
@@ -396,7 +402,9 @@
ctx.destroySubcontext(testUserDN);
} finally {
if(ctx != null)
+ {
ctx.close();
+ }
}
}
diff --git a/opendj-server-legacy/src/test/java/org/opends/server/plugins/UniqueAttributePluginTestCase.java b/opendj-server-legacy/src/test/java/org/opends/server/plugins/UniqueAttributePluginTestCase.java
index c01d49e..950fc4a 100644
--- a/opendj-server-legacy/src/test/java/org/opends/server/plugins/UniqueAttributePluginTestCase.java
+++ b/opendj-server-legacy/src/test/java/org/opends/server/plugins/UniqueAttributePluginTestCase.java
@@ -845,7 +845,9 @@
AttributeType attrType =
DirectoryServer.getAttributeType(attrTypeString);
if (attrType == null)
+ {
attrType = DirectoryServer.getDefaultAttributeType(attrTypeString);
+ }
return attrType;
}
diff --git a/opendj-server-legacy/src/test/java/org/opends/server/protocols/jmx/JmxConnectTest.java b/opendj-server-legacy/src/test/java/org/opends/server/protocols/jmx/JmxConnectTest.java
index 9d40d04..88ca855 100644
--- a/opendj-server-legacy/src/test/java/org/opends/server/protocols/jmx/JmxConnectTest.java
+++ b/opendj-server-legacy/src/test/java/org/opends/server/protocols/jmx/JmxConnectTest.java
@@ -509,8 +509,11 @@
String[] credentials;
if ((user == null) && (password == null)) {
credentials = null;
- } else
+ }
+ else
+ {
credentials = new String[] { user, password };
+ }
env.put("jmx.remote.credentials", credentials);
env.put("jmx.remote.x.client.connection.check.period", 0);
@@ -543,8 +546,11 @@
String[] credentials;
if ((user == null) && (password == null)) {
credentials = null;
- } else
+ }
+ else
+ {
credentials = new String[] { user, password };
+ }
env.put("jmx.remote.credentials", credentials);
// Provide the Trust manager.
@@ -601,7 +607,9 @@
Attribute status = (Attribute) mbsc.getAttribute(name,
"ds-cfg-enabled");
if (status != null)
+ {
status.getValue();
+ }
Attribute attr = new Attribute(
"ds-cfg-enabled", enabled);
mbsc.setAttribute(name, attr);
diff --git a/opendj-server-legacy/src/test/java/org/opends/server/protocols/ldap/LDAPBinaryOptionTestCase.java b/opendj-server-legacy/src/test/java/org/opends/server/protocols/ldap/LDAPBinaryOptionTestCase.java
index f215900..a8d9a9b 100644
--- a/opendj-server-legacy/src/test/java/org/opends/server/protocols/ldap/LDAPBinaryOptionTestCase.java
+++ b/opendj-server-legacy/src/test/java/org/opends/server/protocols/ldap/LDAPBinaryOptionTestCase.java
@@ -323,13 +323,7 @@
for (ByteString v : a.getValues())
{
String val = v.toString();
- if(val.equals("sn#1") || val.equals("sn#2")
- || val.equals("sn#3"))
- {
- snWithMultiVal = true;
- }
- else //All the values should match.
- snWithMultiVal = false;
+ snWithMultiVal = val.equals("sn#1") || val.equals("sn#2") || val.equals("sn#3");
}
}
}
diff --git a/opendj-server-legacy/src/test/java/org/opends/server/protocols/ldap/LdapTestCase.java b/opendj-server-legacy/src/test/java/org/opends/server/protocols/ldap/LdapTestCase.java
index 89223be..ca16b5b 100644
--- a/opendj-server-legacy/src/test/java/org/opends/server/protocols/ldap/LdapTestCase.java
+++ b/opendj-server-legacy/src/test/java/org/opends/server/protocols/ldap/LdapTestCase.java
@@ -76,7 +76,9 @@
LDAPAttribute o1 = e1.next();
LDAPAttribute o2 = e2.next();
if (o1 == null ? o2 != null : !testEqual(o1, o2))
+ {
return false;
+ }
}
return !e1.hasNext() && !e2.hasNext();
}
diff --git a/opendj-server-legacy/src/test/java/org/opends/server/replication/DependencyTest.java b/opendj-server-legacy/src/test/java/org/opends/server/replication/DependencyTest.java
index b7a4332..e603ef5 100644
--- a/opendj-server-legacy/src/test/java/org/opends/server/replication/DependencyTest.java
+++ b/opendj-server-legacy/src/test/java/org/opends/server/replication/DependencyTest.java
@@ -231,7 +231,9 @@
{
remove(replServer);
if (domain != null)
+ {
MultimasterReplication.deleteDomain(baseDN);
+ }
}
}
@@ -335,7 +337,9 @@
{
remove(replServer);
if (domain != null)
+ {
MultimasterReplication.deleteDomain(baseDN);
+ }
}
}
@@ -483,7 +487,9 @@
{
remove(replServer);
if (domain != null)
+ {
MultimasterReplication.deleteDomain(baseDN);
+ }
}
}
@@ -579,7 +585,9 @@
{
remove(replServer);
if (domain != null)
+ {
MultimasterReplication.deleteDomain(baseDN);
+ }
}
}
diff --git a/opendj-server-legacy/src/test/java/org/opends/server/replication/GenerationIdTest.java b/opendj-server-legacy/src/test/java/org/opends/server/replication/GenerationIdTest.java
index 73ac230..5920959 100644
--- a/opendj-server-legacy/src/test/java/org/opends/server/replication/GenerationIdTest.java
+++ b/opendj-server-legacy/src/test/java/org/opends/server/replication/GenerationIdTest.java
@@ -332,11 +332,17 @@
if (all)
{
if (replServerId != replServerId1)
+ {
servers.add("localhost:" + getRSPort(replServerId1));
+ }
if (replServerId != replServerId2)
+ {
servers.add("localhost:" + getRSPort(replServerId2));
+ }
if (replServerId != replServerId3)
+ {
servers.add("localhost:" + getRSPort(replServerId3));
+ }
}
int rsPort = getRSPort(replServerId);
String rsDir = "generationIdTest" + replServerId + testCase + "Db";
@@ -1012,7 +1018,9 @@
if (replServer1.getGenerationId(baseDN) == expectedGenId
&& replServer2.getGenerationId(baseDN) == expectedGenId
&& replServer3.getGenerationId(baseDN) == expectedGenId)
+ {
break;
+ }
wait++;
Thread.sleep(100);
}
diff --git a/opendj-server-legacy/src/test/java/org/opends/server/replication/InitOnLineTest.java b/opendj-server-legacy/src/test/java/org/opends/server/replication/InitOnLineTest.java
index 6ec34b3..706752e 100644
--- a/opendj-server-legacy/src/test/java/org/opends/server/replication/InitOnLineTest.java
+++ b/opendj-server-legacy/src/test/java/org/opends/server/replication/InitOnLineTest.java
@@ -324,7 +324,9 @@
// and ReplLDIFOutputStream with big entries
char bigAttributeValue[] = new char[30240];
for (int i=0; i<bigAttributeValue.length; i++)
+ {
bigAttributeValue[i] = Integer.toString(i).charAt(0);
+ }
String[] entries = new String[entriesCnt + 2];
entries[0] = "dn: " + EXAMPLE_DN + "\n"
@@ -403,7 +405,9 @@
log("Broker " + serverId + " Wait for entry or done msg");
ReplicationMsg msg = broker.receive();
if (msg == null)
+ {
break;
+ }
if (msg instanceof InitializeTargetMsg)
{
@@ -474,11 +478,17 @@
{
SortedSet<String> servers = new TreeSet<>();
if (replServerId != replServer1ID)
+ {
servers.add("localhost:" + getReplServerPort(replServer1ID));
+ }
if (replServerId != replServer2ID)
+ {
servers.add("localhost:" + getReplServerPort(replServer2ID));
+ }
if (replServerId != replServer3ID)
+ {
servers.add("localhost:" + getReplServerPort(replServer3ID));
+ }
final int port = getReplServerPort(replServerId);
ReplServerFakeConfiguration conf =
@@ -551,8 +561,10 @@
connectServer1ToReplServer(replServer1ID);
if (server2 == null)
+ {
server2 = openReplicationSession(baseDN,
server2ID, 100, getReplServerPort(replServer1ID), 1000);
+ }
// In S1 launch the total update
addTask(taskInitFromS2, ResultCode.SUCCESS, null);
@@ -602,8 +614,10 @@
addTestEntriesToDB();
if (server2 == null)
+ {
server2 = openReplicationSession(baseDN,
server2ID, 100, getReplServerPort(replServer1ID), 1000);
+ }
InitializeRequestMsg initMsg = new InitializeRequestMsg(baseDN, server2ID, server1ID, 100);
server2.publish(initMsg);
@@ -644,8 +658,10 @@
// S1 is the server we are running in, S2 is simulated by a broker
if (server2 == null)
+ {
server2 = openReplicationSession(baseDN,
server2ID, 100, getReplServerPort(replServer1ID), 1000);
+ }
// Launch in S1 the task that will initialize S2
addTask(taskInitTargetS2, ResultCode.SUCCESS, null);
@@ -694,12 +710,16 @@
// S1 is the server we are running in, S2 and S3 are simulated by brokers
if (server2 == null)
+ {
server2 = openReplicationSession(baseDN,
server2ID, 100, getReplServerPort(replServer1ID), 1000);
+ }
if (server3 == null)
+ {
server3 = openReplicationSession(baseDN,
server3ID, 100, getReplServerPort(replServer1ID), 1000);
+ }
// Launch in S1 the task that will initialize S2
addTask(taskInitTargetAll, ResultCode.SUCCESS, null);
@@ -736,8 +756,10 @@
// S1 is the server we are running in, S2 is simulated by a broker
if (server2==null)
+ {
server2 = openReplicationSession(baseDN,
server2ID, 100, getReplServerPort(replServer1ID), 1000);
+ }
// Creates config to synchronize suffix
connectServer1ToReplServer(replServer1ID);
@@ -753,7 +775,9 @@
{
readGenerationId = replDomain.getGenerationID();
if (readGenerationId == EXPECTED_GENERATION_ID)
+ {
break;
+ }
log(testCase + " genId=" + readGenerationId);
Thread.sleep(1000);
}
diff --git a/opendj-server-legacy/src/test/java/org/opends/server/replication/ReplicationTestCase.java b/opendj-server-legacy/src/test/java/org/opends/server/replication/ReplicationTestCase.java
index 7ec22c9..886da08 100644
--- a/opendj-server-legacy/src/test/java/org/opends/server/replication/ReplicationTestCase.java
+++ b/opendj-server-legacy/src/test/java/org/opends/server/replication/ReplicationTestCase.java
@@ -256,7 +256,9 @@
checkConnection(30, broker, port);
if (timeout != 0)
+ {
broker.setSoTimeout(timeout);
+ }
}
/**
@@ -292,7 +294,9 @@
protected void deleteEntry(DN dn) throws Exception
{
if (dn.parent().rdn().toString().equalsIgnoreCase("cn=domains"))
+ {
deleteEntry(DN.valueOf("cn=external changelog," + dn));
+ }
DeleteOperation op = connection.processDelete(dn);
assertTrue(op.getResultCode() == SUCCESS || op.getResultCode() == NO_SUCH_OBJECT,
@@ -351,7 +355,9 @@
// Check for unexpected replication config/objects left
if (callParanoiaCheck)
+ {
paranoiaCheck();
+ }
}
/**
@@ -513,7 +519,9 @@
do
{
if (count++>0)
+ {
Thread.sleep(100);
+ }
op = connection.processSearch(newSearchRequest("cn=replication,cn=monitor", WHOLE_SUBTREE, monitorFilter));
}
while (op.getSearchEntries().isEmpty() && (count<100));
@@ -533,7 +541,9 @@
boolean found = false;
int count = timeout/100;
if (count<1)
+ {
count=1;
+ }
do
{
@@ -564,7 +574,9 @@
{
int count = timeout/200;
if (count<1)
+ {
count=1;
+ }
Thread.sleep(50);
boolean found = DirectoryServer.entryExists(dn);
while ((count> 0) && (found != exist))
diff --git a/opendj-server-legacy/src/test/java/org/opends/server/replication/StressTest.java b/opendj-server-legacy/src/test/java/org/opends/server/replication/StressTest.java
index 74ccec6..468de32 100644
--- a/opendj-server-legacy/src/test/java/org/opends/server/replication/StressTest.java
+++ b/opendj-server-legacy/src/test/java/org/opends/server/replication/StressTest.java
@@ -267,7 +267,9 @@
{
ReplicationMsg msg = broker.receive();
if (msg == null)
+ {
break;
+ }
count ++;
}
} catch (Exception e)
@@ -318,10 +320,13 @@
{
Attribute attr;
if (reader == null)
+ {
attr = Attributes.create("received-messages", "not yet started");
+ }
else
- attr = Attributes.create("received-messages", String
- .valueOf(reader.getCurrentCount()));
+ {
+ attr = Attributes.create("received-messages", String.valueOf(reader.getCurrentCount()));
+ }
List<Attribute> list = new LinkedList<>();
list.add(attr);
attr = Attributes.create("base-dn", "ou=People," + TEST_ROOT_DN_STRING);
diff --git a/opendj-server-legacy/src/test/java/org/opends/server/replication/plugin/AssuredReplicationPluginTest.java b/opendj-server-legacy/src/test/java/org/opends/server/replication/plugin/AssuredReplicationPluginTest.java
index 9d11f7b..a7e421d 100644
--- a/opendj-server-legacy/src/test/java/org/opends/server/replication/plugin/AssuredReplicationPluginTest.java
+++ b/opendj-server-legacy/src/test/java/org/opends/server/replication/plugin/AssuredReplicationPluginTest.java
@@ -757,7 +757,9 @@
replicationServer = new FakeReplicationServer(rsGroupId, replServerPort, RS_SERVER_ID,
1, testcase);
if (rsGroupId != 1)
+ {
replicationServer.setAssured(false);
+ }
replicationServer.start(TIMEOUT_SCENARIO);
long startTime;
@@ -866,7 +868,9 @@
replicationServer = new FakeReplicationServer(rsGroupId, replServerPort, RS_SERVER_ID,
true, testcase);
if (rsGroupId != 1)
+ {
replicationServer.setAssured(false);
+ }
replicationServer.start(TIMEOUT_SCENARIO);
long startTime;
@@ -983,8 +987,10 @@
do
{
nsec++;
- if (nsec == 10) // 10 seconds timeout
+ if (nsec == 10)
+ {
fail(testCase + ": timeout waiting for domain connection to fake RS after " + nsec + " seconds.");
+ }
Thread.sleep(1000);
} while (!rs.isHandshakeOk());
}
@@ -999,8 +1005,10 @@
do
{
nsec++;
- if (nsec == 10) // 10 seconds timeout
+ if (nsec == 10)
+ {
fail(testCase + ": timeout waiting for scenario to be exectued on fake RS after " + nsec + " seconds.");
+ }
Thread.sleep(1000);
} while (!rs.isScenarioExecuted());
}
@@ -1143,7 +1151,9 @@
AckMsg ackMsg = replicationServer.sendAssuredAddMsg(entry, parentUid);
if (rsGroupId == 2)
- fail("Should only go here for RS with same group id as DS");
+ {
+ fail("Should only go here for RS with same group id as DS");
+ }
// Ack received, replay has occurred
assertNotNull(DirectoryServer.getEntry(entry.getName()));
@@ -1166,7 +1176,9 @@
{
// Expected
if (rsGroupId == 1)
- fail("Should only go here for RS with group id different from DS one");
+ {
+ fail("Should only go here for RS with group id different from DS one");
+ }
return;
}
@@ -1468,7 +1480,9 @@
do
{
if (count++>0)
+ {
Thread.sleep(100);
+ }
final SearchRequest request = newSearchRequest(dn, SearchScope.WHOLE_SUBTREE, monitorFilter);
op = connection.processSearch(request);
}
@@ -1497,7 +1511,9 @@
List<Attribute> attrs = entry.getAttribute(assuredAttr);
if (attrs == null || attrs.isEmpty())
+ {
return Collections.emptyMap();
+ }
// Parse and store values
Map<Integer,Integer> resultMap = new HashMap<>();
@@ -1525,8 +1541,10 @@
Thread.sleep(50);
ii++;
if (ii>10)
+ {
assertEquals(operation.getResultCode(), expectedResult,
operation.getErrorMessage().toString());
+ }
}
}
}
diff --git a/opendj-server-legacy/src/test/java/org/opends/server/replication/plugin/DomainFakeCfg.java b/opendj-server-legacy/src/test/java/org/opends/server/replication/plugin/DomainFakeCfg.java
index 82cc6da..1576f53 100644
--- a/opendj-server-legacy/src/test/java/org/opends/server/replication/plugin/DomainFakeCfg.java
+++ b/opendj-server-legacy/src/test/java/org/opends/server/replication/plugin/DomainFakeCfg.java
@@ -119,7 +119,9 @@
this.assuredSdLevel = assuredSdLevel;
this.assuredTimeout = assuredTimeout;
if (refUrls != null)
+ {
this.refUrls = refUrls;
+ }
}
/** {@inheritDoc} */
diff --git a/opendj-server-legacy/src/test/java/org/opends/server/replication/plugin/GroupIdHandshakeTest.java b/opendj-server-legacy/src/test/java/org/opends/server/replication/plugin/GroupIdHandshakeTest.java
index f058b41..68d9d8e 100644
--- a/opendj-server-legacy/src/test/java/org/opends/server/replication/plugin/GroupIdHandshakeTest.java
+++ b/opendj-server-legacy/src/test/java/org/opends/server/replication/plugin/GroupIdHandshakeTest.java
@@ -162,7 +162,9 @@
String serverStr = rd.getReplicationServer();
rdPort = HostPort.valueOf(serverStr).getPort();
if (rdPort == rsPort)
+ {
rightPort = true;
+ }
}
if (connected && rightPort)
{
@@ -219,8 +221,11 @@
replServers.add("localhost:" + rs1Port);
replServers.add("localhost:" + rs2Port);
replServers.add("localhost:" + rs3Port);
- } else
+ }
+ else
+ {
fail("Unknown test case: " + testCase);
+ }
return replServers;
}
@@ -248,7 +253,9 @@
replServers.add("localhost:" + rs3Port);
}
else
+ {
fail("Unknown test case: " + testCase);
+ }
}
else if (serverId == RS2_ID)
{
@@ -263,8 +270,11 @@
// 3 servers used for this test case.
replServers.add("localhost:" + rs1Port);
replServers.add("localhost:" + rs3Port);
- } else
+ }
+ else
+ {
fail("Unknown test case: " + testCase);
+ }
}
else if (serverId == RS3_ID)
{
@@ -276,7 +286,9 @@
replServers.add("localhost:" + rs3Port);
}
else
+ {
fail("Invalid test case: " + testCase);
+ }
}
else
{
diff --git a/opendj-server-legacy/src/test/java/org/opends/server/replication/plugin/IsolationTest.java b/opendj-server-legacy/src/test/java/org/opends/server/replication/plugin/IsolationTest.java
index e6c4f42..1801c4b 100644
--- a/opendj-server-legacy/src/test/java/org/opends/server/replication/plugin/IsolationTest.java
+++ b/opendj-server-legacy/src/test/java/org/opends/server/replication/plugin/IsolationTest.java
@@ -99,7 +99,9 @@
finally
{
if (domain != null)
+ {
MultimasterReplication.deleteDomain(baseDn);
+ }
}
}
}
diff --git a/opendj-server-legacy/src/test/java/org/opends/server/replication/plugin/ReplicationServerFailoverTest.java b/opendj-server-legacy/src/test/java/org/opends/server/replication/plugin/ReplicationServerFailoverTest.java
index ad72289..837dde2 100644
--- a/opendj-server-legacy/src/test/java/org/opends/server/replication/plugin/ReplicationServerFailoverTest.java
+++ b/opendj-server-legacy/src/test/java/org/opends/server/replication/plugin/ReplicationServerFailoverTest.java
@@ -298,7 +298,9 @@
String serverStr = rd.getReplicationServer();
rdPort = HostPort.valueOf(serverStr).getPort();
if (rdPort == rsPort)
+ {
rightPort = true;
+ }
}
if (connected && rightPort)
{
@@ -389,7 +391,9 @@
{
// First check that the Replication domain is connected
if (!rd.isConnected())
+ {
return -1;
+ }
String serverStr = rd.getReplicationServer();
return HostPort.valueOf(serverStr).getPort();
diff --git a/opendj-server-legacy/src/test/java/org/opends/server/replication/plugin/StateMachineTest.java b/opendj-server-legacy/src/test/java/org/opends/server/replication/plugin/StateMachineTest.java
index d2ae777..a08fa52 100644
--- a/opendj-server-legacy/src/test/java/org/opends/server/replication/plugin/StateMachineTest.java
+++ b/opendj-server-legacy/src/test/java/org/opends/server/replication/plugin/StateMachineTest.java
@@ -154,9 +154,13 @@
// Test connection
boolean connected = false;
if (rd != null)
+ {
connected = rd.isConnected();
+ }
else
+ {
connected = rb.isConnected();
+ }
if (connected)
{
@@ -394,9 +398,18 @@
} finally
{
endTest();
- if (bw != null) bw.shutdown();
- if (br3 != null) br3.shutdown();
- if (br2 != null) br2.shutdown();
+ if (bw != null)
+ {
+ bw.shutdown();
+ }
+ if (br3 != null)
+ {
+ br3.shutdown();
+ }
+ if (br2 != null)
+ {
+ br2.shutdown();
+ }
}
}
@@ -670,8 +683,14 @@
{
// Finalize test
endTest();
- if (bw != null) bw.shutdown();
- if (br != null) br.shutdown();
+ if (bw != null)
+ {
+ bw.shutdown();
+ }
+ if (br != null)
+ {
+ br.shutdown();
+ }
}
}
@@ -1006,7 +1025,9 @@
public void pause()
{
if (isPaused())
+ {
return; // Already suspended
+ }
suspended.set(true);
// Wait for all messages sent
while (!sessionDone.get())
@@ -1135,12 +1156,16 @@
ReplicationMsg msg = rb.receive(); // Allow more messages to be sent by broker writer
rb.updateWindowAfterReplay(); // Allow RS to send more messages to broker
if (msg != null)
+ {
debugInfo("Broker " + serverId + " reader received: " + msg);
+ }
lastMsg = msg;
} catch (SocketTimeoutException ex)
{
if (shutdown)
+ {
return;
+ }
}
}
debugInfo("Broker " + serverId + " reader thread is dying");
diff --git a/opendj-server-legacy/src/test/java/org/opends/server/replication/plugin/TopologyViewTest.java b/opendj-server-legacy/src/test/java/org/opends/server/replication/plugin/TopologyViewTest.java
index 646d2d9..b7d2941 100644
--- a/opendj-server-legacy/src/test/java/org/opends/server/replication/plugin/TopologyViewTest.java
+++ b/opendj-server-legacy/src/test/java/org/opends/server/replication/plugin/TopologyViewTest.java
@@ -273,7 +273,9 @@
String serverStr = rd.getReplicationServer();
rdPort = HostPort.valueOf(serverStr).getPort();
if (rdPort == rsPort)
+ {
rightPort = true;
+ }
}
if (connected && rightPort)
{
@@ -1050,7 +1052,9 @@
public boolean equals(Object obj)
{
if (obj == null || getClass() != obj.getClass())
+ {
return false;
+ }
TopoView other = (TopoView) obj;
return checkLists(dsList, other.dsList)
&& checkLists(rsList, other.rsList);
@@ -1059,18 +1063,24 @@
private boolean checkLists(List<?> list, List<?> otherList)
{
if (otherList.size() != list.size())
+ {
return false;
+ }
for (Object otherObj : otherList)
{
int found = 0;
for (Object thisObj : list)
{
if (thisObj.equals(otherObj))
+ {
found++;
+ }
}
// Not found
if (found == 0)
+ {
return false;
+ }
// Should never see twice as dsInfo structure in a dsList
assertFalse(found > 1);
// Ok, found exactly once in the list, examine next structure
diff --git a/opendj-server-legacy/src/test/java/org/opends/server/replication/server/AssuredReplicationServerTest.java b/opendj-server-legacy/src/test/java/org/opends/server/replication/server/AssuredReplicationServerTest.java
index a62f401..97d1f53 100644
--- a/opendj-server-legacy/src/test/java/org/opends/server/replication/server/AssuredReplicationServerTest.java
+++ b/opendj-server-legacy/src/test/java/org/opends/server/replication/server/AssuredReplicationServerTest.java
@@ -301,7 +301,9 @@
fakeReplicationDomain.startPublishService();
if (startListen)
+ {
fakeReplicationDomain.startListenService();
+ }
// Test connection
assertTrue(fakeReplicationDomain.isConnected());
@@ -2906,9 +2908,13 @@
// Check call time
if (fakeDsIsEligible && (fakeDsScen == TIMEOUT_DS_SCENARIO))
+ {
assertBetweenInclusive(sendUpdateTime, SMALL_TIMEOUT, SMALL_TIMEOUT + 1000);
+ }
else
+ {
assertThat(sendUpdateTime).isLessThan(MAX_SEND_UPDATE_TIME);
+ }
// Check monitoring values (check that ack has been correctly received)
Thread.sleep(500); // Sleep a while as counters are updated just after sending thread is unblocked
diff --git a/opendj-server-legacy/src/test/java/org/opends/server/replication/server/MonitorTest.java b/opendj-server-legacy/src/test/java/org/opends/server/replication/server/MonitorTest.java
index 5cb1072..7b76c73 100644
--- a/opendj-server-legacy/src/test/java/org/opends/server/replication/server/MonitorTest.java
+++ b/opendj-server-legacy/src/test/java/org/opends/server/replication/server/MonitorTest.java
@@ -163,9 +163,13 @@
if (all)
{
if (changelogId != changelog1ID)
+ {
servers.add("localhost:" + getChangelogPort(changelog1ID));
+ }
if (changelogId != changelog2ID)
+ {
servers.add("localhost:" + getChangelogPort(changelog2ID));
+ }
}
int chPort = getChangelogPort(changelogId);
String chDir = "monitorTest" + changelogId + suffix + "Db";
diff --git a/opendj-server-legacy/src/test/java/org/opends/server/replication/server/ReplicationServerTest.java b/opendj-server-legacy/src/test/java/org/opends/server/replication/server/ReplicationServerTest.java
index c859386..beb53ae 100644
--- a/opendj-server-legacy/src/test/java/org/opends/server/replication/server/ReplicationServerTest.java
+++ b/opendj-server-legacy/src/test/java/org/opends/server/replication/server/ReplicationServerTest.java
@@ -611,7 +611,9 @@
for (BrokerReader r : reader)
{
if (r != null)
+ {
assertNull(r.errDetails, r.exc + " " + r.errDetails);
+ }
}
}
debugInfo("Ending multipleWriterMultipleReader");
@@ -841,9 +843,13 @@
{
ReplicationMsg msg = broker2.receive();
if (msg == null)
+ {
break;
+ }
if (msg instanceof TopologyMsg)
+ {
continue; // ignore
+ }
msgs.add(msg);
broker2.updateWindowAfterReplay();
@@ -1020,7 +1026,9 @@
// may prevent to process a WindowMsg that would unblock the dual
// writer thread.
if (msg == null)
+ {
break;
+ }
}
} catch (SocketTimeoutException e)
{
@@ -1077,7 +1085,9 @@
broker.publish(msg);
if ((count % 10) == 0)
- debugInfo("writer " + broker.getServerId() + " to send="+count);
+ {
+ debugInfo("writer " + broker.getServerId() + " to send="+count);
+ }
}
debugInfo("writer " + broker.getServerId() + " ends sent="+ccount);
}
@@ -1127,7 +1137,9 @@
// Connect only replicationServer[0] to ReplicationServer[1]
// and not the other way
if (i==0)
+ {
servers.add("localhost:" + changelogPorts[1]);
+ }
ReplServerFakeConfiguration conf =
new ReplServerFakeConfiguration(changelogPorts[i], "replicationServerTestReplicationServerConnectedDb"+i, replicationDbImplementation,
0, changelogIds[i], 0, 100, servers);
diff --git a/opendj-server-legacy/src/test/java/org/opends/server/replication/server/changelog/file/BlockLogReaderWriterTest.java b/opendj-server-legacy/src/test/java/org/opends/server/replication/server/changelog/file/BlockLogReaderWriterTest.java
index 61f344a..6c227be 100644
--- a/opendj-server-legacy/src/test/java/org/opends/server/replication/server/changelog/file/BlockLogReaderWriterTest.java
+++ b/opendj-server-legacy/src/test/java/org/opends/server/replication/server/changelog/file/BlockLogReaderWriterTest.java
@@ -370,8 +370,14 @@
Pair<Boolean, Record<Integer, Integer>> result =
reader.seekToRecord(key, GREATER_THAN_OR_EQUAL_TO_KEY, AFTER_MATCHING_KEY);
final long te = System.nanoTime() - ts;
- if (te < minTime) minTime = te;
- if (te > maxTime) maxTime = te;
+ if (te < minTime)
+ {
+ minTime = te;
+ }
+ if (te > maxTime)
+ {
+ maxTime = te;
+ }
// show time for seeks that last more than N microseconds (tune as needed)
if (te/1000 > 1000)
{
@@ -395,8 +401,14 @@
reader.positionToKey(0, val, GREATER_THAN_OR_EQUAL_TO_KEY, AFTER_MATCHING_KEY);
assertThat(result.getSecond()).isEqualTo(Record.from(val, val));
long te = System.nanoTime() - ts;
- if (te < minTime) minTime = te;
- if (te > maxTime) maxTime = te;
+ if (te < minTime)
+ {
+ minTime = te;
+ }
+ if (te > maxTime)
+ {
+ maxTime = te;
+ }
}
System.out.println("Time taken: " + ((System.nanoTime() - t1)/1000000) + " milliseconds");
System.out.println("Min time for a search: " + minTime/1000 + " microseconds");
diff --git a/opendj-server-legacy/src/test/java/org/opends/server/replication/service/ComputeBestServerTest.java b/opendj-server-legacy/src/test/java/org/opends/server/replication/service/ComputeBestServerTest.java
index ebed185..23806be 100644
--- a/opendj-server-legacy/src/test/java/org/opends/server/replication/service/ComputeBestServerTest.java
+++ b/opendj-server-legacy/src/test/java/org/opends/server/replication/service/ComputeBestServerTest.java
@@ -510,7 +510,9 @@
new CSN(looser1T2, 0, myId2),
new CSN(looser1T3, 0, myId3));
if (looser1IsLocal)
+ {
ReplicationServer.onlyForTestsAddlocalReplicationServer(LOOSER1);
+ }
// State for server 2
ServerState aState2 = newServerState(
@@ -518,7 +520,9 @@
new CSN(winnerT2, 0, myId2),
new CSN(winnerT3, 0, myId3));
if (winnerIsLocal)
+ {
ReplicationServer.onlyForTestsAddlocalReplicationServer(WINNER);
+ }
// State for server 3
ServerState aState3 = newServerState(
@@ -526,7 +530,9 @@
new CSN(looser2T2, 0, myId2),
new CSN(looser2T3, 0, myId3));
if (looser2IsLocal)
+ {
ReplicationServer.onlyForTestsAddlocalReplicationServer(LOOSER2);
+ }
Map<Integer, ReplicationServerInfo> rsInfos = newRSInfos(
newRSInfo(11, LOOSER1, aState1, 0, 1),
@@ -606,17 +612,23 @@
// State for server 1
ServerState aState1 = newServerState(new CSN(looser1T1, 0, myId1));
if (looser1IsLocal)
+ {
ReplicationServer.onlyForTestsAddlocalReplicationServer(LOOSER1);
+ }
// State for server 2
ServerState aState2 = newServerState(new CSN(winnerT1, 0, myId1));
if (winnerIsLocal)
+ {
ReplicationServer.onlyForTestsAddlocalReplicationServer(WINNER);
+ }
// State for server 3
ServerState aState3 = newServerState(new CSN(looser2T1, 0, myId1));
if (looser2IsLocal)
+ {
ReplicationServer.onlyForTestsAddlocalReplicationServer(LOOSER2);
+ }
Map<Integer, ReplicationServerInfo> rsInfos = newRSInfos(
newRSInfo(11, LOOSER1, aState1, looser1GenId, looser1GroupId),
diff --git a/opendj-server-legacy/src/test/java/org/opends/server/replication/service/FakeReplicationDomain.java b/opendj-server-legacy/src/test/java/org/opends/server/replication/service/FakeReplicationDomain.java
index 5c3a5b0..0277238 100644
--- a/opendj-server-legacy/src/test/java/org/opends/server/replication/service/FakeReplicationDomain.java
+++ b/opendj-server-legacy/src/test/java/org/opends/server/replication/service/FakeReplicationDomain.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.server.replication.service;
@@ -155,7 +155,9 @@
ERR_BACKEND_EXPORT_ENTRY.get("", ""));
}
if (ret>0)
+ {
importString.append(new String(buffer, 0, ret));
+ }
}
while (ret >= 0);
}
@@ -164,7 +166,9 @@
public boolean processUpdate(UpdateMsg updateMsg)
{
if (queue != null)
+ {
queue.add(updateMsg);
+ }
return true;
}
diff --git a/opendj-server-legacy/src/test/java/org/opends/server/replication/service/FakeStressReplicationDomain.java b/opendj-server-legacy/src/test/java/org/opends/server/replication/service/FakeStressReplicationDomain.java
index e58e8d8..850cef7 100644
--- a/opendj-server-legacy/src/test/java/org/opends/server/replication/service/FakeStressReplicationDomain.java
+++ b/opendj-server-legacy/src/test/java/org/opends/server/replication/service/FakeStressReplicationDomain.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.server.replication.service;
@@ -138,7 +138,9 @@
public boolean processUpdate(UpdateMsg updateMsg)
{
if (queue != null)
+ {
queue.add(updateMsg);
+ }
return true;
}
}
diff --git a/opendj-server-legacy/src/test/java/org/opends/server/schema/AttributeSyntaxTest.java b/opendj-server-legacy/src/test/java/org/opends/server/schema/AttributeSyntaxTest.java
index 66c3988..23224c9 100644
--- a/opendj-server-legacy/src/test/java/org/opends/server/schema/AttributeSyntaxTest.java
+++ b/opendj-server-legacy/src/test/java/org/opends/server/schema/AttributeSyntaxTest.java
@@ -64,8 +64,7 @@
* Test the normalization and the approximate comparison.
*/
@Test(dataProvider= "acceptableValues")
- public void testAcceptableValues(String value, Boolean result)
- throws Exception
+ public void testAcceptableValues(String value, Boolean result) throws Exception
{
// Make sure that the specified class can be instantiated as a task.
@@ -80,8 +79,8 @@
syntax.valueIsAcceptable(ByteString.valueOf(value), reason);
if (liveResult != result)
- fail(syntax + ".valueIsAcceptable gave bad result for " + value +
- "reason : " + reason);
-
+ {
+ fail(syntax + ".valueIsAcceptable gave bad result for " + value + " reason : " + reason);
+ }
}
}
diff --git a/opendj-server-legacy/src/test/java/org/opends/server/schema/BitStringSyntaxTest.java b/opendj-server-legacy/src/test/java/org/opends/server/schema/BitStringSyntaxTest.java
index 6df224a..f19b362 100644
--- a/opendj-server-legacy/src/test/java/org/opends/server/schema/BitStringSyntaxTest.java
+++ b/opendj-server-legacy/src/test/java/org/opends/server/schema/BitStringSyntaxTest.java
@@ -80,8 +80,8 @@
syntax.valueIsAcceptable(byteStringValue, reason);
if (liveResult != result)
- fail(syntax + ".valueIsAcceptable gave bad result for " + value +
- "reason : " + reason);
-
+ {
+ fail(syntax + ".valueIsAcceptable gave bad result for " + value + " reason : " + reason);
+ }
}
}
--
Gitblit v1.10.0