From 9047861998d299cdbb3fce2b20fc2cd5fce47a39 Mon Sep 17 00:00:00 2001
From: Ludovic Poitou <ludovic.poitou@forgerock.com>
Date: Wed, 03 Nov 2010 11:19:08 +0000
Subject: [PATCH] Fix defect OpenDJ-7 : NPE in appliesToEntry(VirtualAttributeRule.java:321) at Startup.

---
 opends/src/server/org/opends/server/core/DirectoryServer.java |   18 +++++++++++++++---
 1 files changed, 15 insertions(+), 3 deletions(-)

diff --git a/opends/src/server/org/opends/server/core/DirectoryServer.java b/opends/src/server/org/opends/server/core/DirectoryServer.java
index e5f121d..3b19a61 100644
--- a/opends/src/server/org/opends/server/core/DirectoryServer.java
+++ b/opends/src/server/org/opends/server/core/DirectoryServer.java
@@ -23,6 +23,7 @@
  *
  *
  *      Copyright 2006-2010 Sun Microsystems, Inc.
+ *      Portions Copyright 2010 ForgeRock AS.
  */
 package org.opends.server.core;
 
@@ -1436,6 +1437,12 @@
       // Initialize the group manager.
       initializeGroupManager();
 
+      // Now we can initialize both subentry manager and group manager
+      // for this backend.
+      subentryManager.performBackendInitializationProcessing(
+              configHandler);
+      groupManager.performBackendInitializationProcessing(configHandler);
+
       // Initialize the access control handler.
       AccessControlConfigManager.getInstance().initializeAccessControl();
 
@@ -2687,7 +2694,9 @@
 
     // The configuration backend has already been registered by this point
     // so we need to handle it explicitly.
-    groupManager.performBackendInitializationProcessing(configHandler);
+    // Because subentryManager may depend on the groupManager, let's
+    // delay this.
+    // groupManager.performBackendInitializationProcessing(configHandler);
   }
 
 
@@ -2908,10 +2917,13 @@
     try
     {
       subentryManager = new SubentryManager();
+
       // The configuration backend should already be registered
       // at this point so we need to handle it explicitly here.
-      subentryManager.performBackendInitializationProcessing(
-              configHandler);
+      // However, subentryManager may have dependencies on the
+      // groupManager. So lets delay the backend initialization until then.
+      // subentryManager.performBackendInitializationProcessing(
+      //        configHandler);
     }
     catch (DirectoryException de)
     {

--
Gitblit v1.10.0