directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From seelm...@apache.org
Subject svn commit: r1150229 - /directory/apacheds/trunk/service-builder/src/main/java/org/apache/directory/server/config/ServiceBuilder.java
Date Sat, 23 Jul 2011 22:10:23 GMT
Author: seelmann
Date: Sat Jul 23 22:10:22 2011
New Revision: 1150229

URL: http://svn.apache.org/viewvc?rev=1150229&view=rev
Log:
Fix NPE: if one transport is disabled the Transport array contains a null element.

Modified:
    directory/apacheds/trunk/service-builder/src/main/java/org/apache/directory/server/config/ServiceBuilder.java

Modified: directory/apacheds/trunk/service-builder/src/main/java/org/apache/directory/server/config/ServiceBuilder.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/service-builder/src/main/java/org/apache/directory/server/config/ServiceBuilder.java?rev=1150229&r1=1150228&r2=1150229&view=diff
==============================================================================
--- directory/apacheds/trunk/service-builder/src/main/java/org/apache/directory/server/config/ServiceBuilder.java
(original)
+++ directory/apacheds/trunk/service-builder/src/main/java/org/apache/directory/server/config/ServiceBuilder.java
Sat Jul 23 22:10:22 2011
@@ -533,18 +533,17 @@ public class ServiceBuilder
      */
     public static Transport[] createTransports( TransportBean[] transportBeans )
     {
-        Transport[] transports = new Transport[ transportBeans.length ];
-        int i = 0;
+        List<Transport> transports = new ArrayList<Transport>();
         
         for ( TransportBean transportBean : transportBeans )
         {
             if ( transportBean.isEnabled() )
             {
-                transports[i++] = createTransport( transportBean );
+                transports.add( createTransport( transportBean ) );
             }
         }
         
-        return transports;
+        return transports.toArray( new Transport[transports.size()] );
     }
     /**
      * Helper method to create an Array of EncryptionTypes from an array of Strings



Mime
View raw message