directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pamarce...@apache.org
Subject svn commit: r1036393 - /directory/apacheds/trunk/server-config/src/main/java/org/apache/directory/server/config/beans/ConfigBean.java
Date Thu, 18 Nov 2010 10:48:43 GMT
Author: pamarcelot
Date: Thu Nov 18 10:48:43 2010
New Revision: 1036393

URL: http://svn.apache.org/viewvc?rev=1036393&view=rev
Log:
Fixed a NPE if 'directoryServiceBeans' list is null.

Modified:
    directory/apacheds/trunk/server-config/src/main/java/org/apache/directory/server/config/beans/ConfigBean.java

Modified: directory/apacheds/trunk/server-config/src/main/java/org/apache/directory/server/config/beans/ConfigBean.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/server-config/src/main/java/org/apache/directory/server/config/beans/ConfigBean.java?rev=1036393&r1=1036392&r2=1036393&view=diff
==============================================================================
--- directory/apacheds/trunk/server-config/src/main/java/org/apache/directory/server/config/beans/ConfigBean.java
(original)
+++ directory/apacheds/trunk/server-config/src/main/java/org/apache/directory/server/config/beans/ConfigBean.java
Thu Nov 18 10:48:43 2010
@@ -19,27 +19,30 @@
  */
 package org.apache.directory.server.config.beans;
 
+
 import java.util.List;
 
+
 /**
  * The base class containing all the configuration hierarchy. This hierarchy
  * starts with the DirectoryService elements.
  *
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
-public class ConfigBean 
+public class ConfigBean
 {
     /** The DirectoryService beans */
     private List<AdsBaseBean> directoryServiceBeans;
 
+
     /**
      * Create a new ConfigBean instance
      */
     public ConfigBean()
     {
     }
-    
-    
+
+
     /**
      * Add underlying DirectoryServiceBean
      * @param directoryServiceBeans The DirectoryServiceBeans
@@ -71,15 +74,15 @@ public class ConfigBean 
         {
             return null;
         }
-        
+
         for ( AdsBaseBean bean : directoryServiceBeans )
         {
             if ( bean instanceof DirectoryServiceBean )
             {
-                return (DirectoryServiceBean)bean;
+                return ( DirectoryServiceBean ) bean;
             }
         }
-        
+
         return null;
     }
 
@@ -94,18 +97,18 @@ public class ConfigBean 
         {
             return null;
         }
-        
+
         for ( AdsBaseBean bean : directoryServiceBeans )
         {
             if ( bean instanceof DirectoryServiceBean )
             {
-                if ( ((DirectoryServiceBean)bean).getDirectoryServiceId().equals( directoryServiceId
) )
+                if ( ( ( DirectoryServiceBean ) bean ).getDirectoryServiceId().equals( directoryServiceId
) )
                 {
-                    return (DirectoryServiceBean)bean;
+                    return ( DirectoryServiceBean ) bean;
                 }
             }
         }
-        
+
         return null;
     }
 
@@ -117,20 +120,23 @@ public class ConfigBean 
     {
         this.directoryServiceBeans = directoryServiceBeans;
     }
-    
-    
+
+
     /**
      * {@inheritDoc}
      */
     public String toString()
     {
         StringBuilder sb = new StringBuilder();
-     
-        for ( AdsBaseBean directoryService : directoryServiceBeans )
+
+        if ( directoryServiceBeans != null )
         {
-            sb.append( directoryService ).append( "\n\n" );
+            for ( AdsBaseBean directoryService : directoryServiceBeans )
+            {
+                sb.append( directoryService ).append( "\n\n" );
+            }
         }
-        
+
         return sb.toString();
     }
 }



Mime
View raw message