From 2e790b382035a9ef69ceb5b3ceda516f038ccb2c Mon Sep 17 00:00:00 2001
From: Ludovic Poitou <ludovic.poitou@forgerock.com>
Date: Mon, 02 Jan 2012 15:35:55 +0000
Subject: [PATCH] Fix minor issues and optimizations proposed by FindBugs and NetBeans

---
 opends/src/server/org/opends/server/backends/RootDSEBackend.java |   24 ++++++++++++++++--------
 1 files changed, 16 insertions(+), 8 deletions(-)

diff --git a/opends/src/server/org/opends/server/backends/RootDSEBackend.java b/opends/src/server/org/opends/server/backends/RootDSEBackend.java
index cf82ccf..30b6ad6 100644
--- a/opends/src/server/org/opends/server/backends/RootDSEBackend.java
+++ b/opends/src/server/org/opends/server/backends/RootDSEBackend.java
@@ -23,6 +23,7 @@
  *
  *
  *      Copyright 2006-2010 Sun Microsystems, Inc.
+ *      Portions Copyright 2011 ForgeRock AS
  */
 package org.opends.server.backends;
 
@@ -438,9 +439,10 @@
       baseMap = subordinateBaseDNs;
     }
 
-    for (DN subBase : baseMap.keySet())
+    for (Map.Entry entry : baseMap.entrySet())
     {
-      Backend b = baseMap.get(subBase);
+      DN subBase = (DN)entry.getKey();
+      Backend b = (Backend)entry.getValue();
       Entry subBaseEntry = b.getEntry(subBase);
       if (subBaseEntry != null)
       {
@@ -944,11 +946,12 @@
       baseMap = subordinateBaseDNs;
     }
 
-    for (DN baseDN : baseMap.keySet())
+    for (Map.Entry entry : baseMap.entrySet())
     {
+      DN baseDN = (DN)entry.getKey();
       if (entryDN.isDescendantOf(baseDN))
       {
-        Backend b = baseMap.get(baseDN);
+        Backend b = (Backend)entry.getValue();
         if (b.entryExists(entryDN))
         {
           return true;
@@ -1058,11 +1061,12 @@
           baseMap = subordinateBaseDNs;
         }
 
-        for (DN subBase : baseMap.keySet())
+        for (Map.Entry entry : baseMap.entrySet())
         {
+          DN subBase = (DN)entry.getKey();
           searchOperation.checkIfCanceled(false);
 
-          Backend b = baseMap.get(subBase);
+          Backend b = (Backend)entry.getValue();
           Entry subBaseEntry = b.getEntry(subBase);
           if ((subBaseEntry != null) && filter.matchesEntry(subBaseEntry))
           {
@@ -1085,13 +1089,14 @@
 
         try
         {
-          for (DN subBase : baseMap.keySet())
+          for (Map.Entry entry : baseMap.entrySet())
           {
             searchOperation.checkIfCanceled(false);
 
-            Backend b = baseMap.get(subBase);
+            DN subBase = (DN)entry.getKey();
             searchOperation.setBaseDN(subBase);
 
+            Backend b = (Backend)entry.getValue();
             try
             {
               b.search(searchOperation);
@@ -1368,6 +1373,7 @@
   /**
    * {@inheritDoc}
    */
+  @Override
   public boolean isConfigurationChangeAcceptable(
        RootDSEBackendCfg cfg,
        List<Message> unacceptableReasons)
@@ -1419,6 +1425,7 @@
   /**
    * {@inheritDoc}
    */
+  @Override
   public ConfigChangeResult applyConfigurationChange(RootDSEBackendCfg cfg)
   {
     ResultCode         resultCode          = ResultCode.SUCCESS;
@@ -1585,6 +1592,7 @@
   /**
    * {@inheritDoc}
    */
+  @Override
   public void preloadEntryCache() throws UnsupportedOperationException {
     throw new UnsupportedOperationException("Operation not supported.");
   }

--
Gitblit v1.10.0