directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pamarce...@apache.org
Subject svn commit: r1222225 - /directory/studio/trunk/plugins/ldapbrowser.core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/schema/SchemaUtils.java
Date Thu, 22 Dec 2011 13:40:33 GMT
Author: pamarcelot
Date: Thu Dec 22 13:40:33 2011
New Revision: 1222225

URL: http://svn.apache.org/viewvc?rev=1222225&view=rev
Log:
Prevent potential NPEs.

Modified:
    directory/studio/trunk/plugins/ldapbrowser.core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/schema/SchemaUtils.java

Modified: directory/studio/trunk/plugins/ldapbrowser.core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/schema/SchemaUtils.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/ldapbrowser.core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/schema/SchemaUtils.java?rev=1222225&r1=1222224&r2=1222225&view=diff
==============================================================================
--- directory/studio/trunk/plugins/ldapbrowser.core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/schema/SchemaUtils.java
(original)
+++ directory/studio/trunk/plugins/ldapbrowser.core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/schema/SchemaUtils.java
Thu Dec 22 13:40:33 2011
@@ -367,13 +367,17 @@ public class SchemaUtils
     {
         Schema schema = entry.getBrowserConnection().getSchema();
         Collection<AttributeType> atds = new HashSet<AttributeType>();
-        for ( ObjectClass ocd : entry.getObjectClassDescriptions() )
+        Collection<ObjectClass> ocds = entry.getObjectClassDescriptions();
+        if ( ocds != null )
         {
-            Collection<String> musts = getMustAttributeTypeDescriptionNamesTransitive(
ocd, schema );
-            for ( String must : musts )
+            for ( ObjectClass ocd : entry.getObjectClassDescriptions() )
             {
-                AttributeType atd = schema.getAttributeTypeDescription( must );
-                atds.add( atd );
+                Collection<String> musts = getMustAttributeTypeDescriptionNamesTransitive(
ocd, schema );
+                for ( String must : musts )
+                {
+                    AttributeType atd = schema.getAttributeTypeDescription( must );
+                    atds.add( atd );
+                }
             }
         }
         return atds;
@@ -391,13 +395,17 @@ public class SchemaUtils
     {
         Schema schema = entry.getBrowserConnection().getSchema();
         Collection<AttributeType> atds = new HashSet<AttributeType>();
-        for ( ObjectClass ocd : entry.getObjectClassDescriptions() )
+        Collection<ObjectClass> ocds = entry.getObjectClassDescriptions();
+        if ( ocds != null )
         {
-            Collection<String> mays = getMayAttributeTypeDescriptionNamesTransitive(
ocd, schema );
-            for ( String may : mays )
+            for ( ObjectClass ocd : entry.getObjectClassDescriptions() )
             {
-                AttributeType atd = schema.getAttributeTypeDescription( may );
-                atds.add( atd );
+                Collection<String> mays = getMayAttributeTypeDescriptionNamesTransitive(
ocd, schema );
+                for ( String may : mays )
+                {
+                    AttributeType atd = schema.getAttributeTypeDescription( may );
+                    atds.add( atd );
+                }
             }
         }
         return atds;



Mime
View raw message