From 41388e8178bd91411face44bba066a5b1e6b34c0 Mon Sep 17 00:00:00 2001
From: jvergara <jvergara@localhost>
Date: Wed, 29 Oct 2008 07:26:36 +0000
Subject: [PATCH] Modify some code to create unmodifiable collections only once in the life cycle of the descriptor objects.

---
 opendj-sdk/opends/src/guitools/org/opends/guitools/controlpanel/util/ConfigReader.java |   32 ++++++++++++++++----------------
 1 files changed, 16 insertions(+), 16 deletions(-)

diff --git a/opendj-sdk/opends/src/guitools/org/opends/guitools/controlpanel/util/ConfigReader.java b/opendj-sdk/opends/src/guitools/org/opends/guitools/controlpanel/util/ConfigReader.java
index 341a480..f50a8ac 100644
--- a/opendj-sdk/opends/src/guitools/org/opends/guitools/controlpanel/util/ConfigReader.java
+++ b/opendj-sdk/opends/src/guitools/org/opends/guitools/controlpanel/util/ConfigReader.java
@@ -32,7 +32,6 @@
 import java.io.File;
 import java.util.ArrayList;
 import java.util.Collections;
-import java.util.HashSet;
 import java.util.List;
 import java.util.Set;
 
@@ -102,8 +101,7 @@
   /**
    * The exceptions that occurred reading the configuration.
    */
-  protected ArrayList<OpenDsException> exceptions =
-    new ArrayList<OpenDsException>();
+  protected List<OpenDsException> exceptions = Collections.emptyList();
 
   /**
    * Whether the configuration has already been read or not.
@@ -113,8 +111,7 @@
   /**
    * The set of connection listeners.
    */
-  protected HashSet<ConnectionHandlerDescriptor> listeners =
-    new HashSet<ConnectionHandlerDescriptor>();
+  protected Set<ConnectionHandlerDescriptor> listeners = Collections.emptySet();
 
   /**
    * The administration connector.
@@ -124,13 +121,12 @@
   /**
    * The set of backend descriptors.
    */
-  protected HashSet<BackendDescriptor> backends =
-    new HashSet<BackendDescriptor>();
+  protected Set<BackendDescriptor> backends = Collections.emptySet();
 
   /**
    * The set of administrative users.
    */
-  protected HashSet<DN> administrativeUsers = new HashSet<DN>();
+  protected Set<DN> administrativeUsers = Collections.emptySet();
 
   /**
    * The replication serve port (-1 if the replication server port is not
@@ -159,30 +155,33 @@
   protected Schema schema;
 
   /**
-   * Returns the Administrative User DNs found in the config.ldif.
+   * Returns the Administrative User DNs found in the config.ldif.  The set
+   * must be unmodifiable (the inheriting classes must take care of this).
    * @return the Administrative User DNs found in the config.ldif.
    */
   public Set<DN> getAdministrativeUsers()
   {
-    return Collections.unmodifiableSet(administrativeUsers);
+    return administrativeUsers;
   }
 
   /**
-   * Returns the backend descriptors found in the config.ldif.
+   * Returns the backend descriptors found in the config.ldif.  The set
+   * must be unmodifiable (the inheriting classes must take care of this).
    * @return the backend descriptors found in the config.ldif.
    */
   public Set<BackendDescriptor> getBackends()
   {
-    return Collections.unmodifiableSet(backends);
+    return backends;
   }
 
   /**
-   * Returns the listener descriptors found in the config.ldif.
+   * Returns the listener descriptors found in the config.ldif.  The set
+   * must be unmodifiable (the inheriting classes must take care of this).
    * @return the listeners descriptors found in the config.ldif.
    */
   public Set<ConnectionHandlerDescriptor> getConnectionHandlers()
   {
-    return Collections.unmodifiableSet(listeners);
+    return listeners;
   }
 
   /**
@@ -196,13 +195,14 @@
 
   /**
    * Returns the list of exceptions that were encountered reading the
-   * configuration.
+   * configuration.  The list must be unmodifiable (the inheriting classes must
+   * take care of this).
    * @return the list of exceptions that were encountered reading the
    * configuration.
    */
   public List<OpenDsException> getExceptions()
   {
-    return Collections.unmodifiableList(exceptions);
+    return exceptions;
   }
 
   /**

--
Gitblit v1.10.0