You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by se...@apache.org on 2009/10/05 00:49:30 UTC

svn commit: r821633 - in /directory/studio/trunk/ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/impl: AbstractEntry.java DummyEntry.java

Author: seelmann
Date: Sun Oct  4 22:49:30 2009
New Revision: 821633

URL: http://svn.apache.org/viewvc?rev=821633&view=rev
Log:
Fix for DIRSTUDIO-552: NPE if entry contains no objectClass attribute

Modified:
    directory/studio/trunk/ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/impl/AbstractEntry.java
    directory/studio/trunk/ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/impl/DummyEntry.java

Modified: directory/studio/trunk/ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/impl/AbstractEntry.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/impl/AbstractEntry.java?rev=821633&r1=821632&r2=821633&view=diff
==============================================================================
--- directory/studio/trunk/ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/impl/AbstractEntry.java (original)
+++ directory/studio/trunk/ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/impl/AbstractEntry.java Sun Oct  4 22:49:30 2009
@@ -852,7 +852,7 @@
         IAttribute ocAttribute = getAttribute( SchemaConstants.OBJECT_CLASS_AT );
         if ( ocAttribute != null )
         {
-            String[] ocNames = getAttribute( SchemaConstants.OBJECT_CLASS_AT ).getStringValues();
+            String[] ocNames = ocAttribute.getStringValues();
             Schema schema = getBrowserConnection().getSchema();
             for ( String ocName : ocNames )
             {

Modified: directory/studio/trunk/ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/impl/DummyEntry.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/impl/DummyEntry.java?rev=821633&r1=821632&r2=821633&view=diff
==============================================================================
--- directory/studio/trunk/ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/impl/DummyEntry.java (original)
+++ directory/studio/trunk/ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/impl/DummyEntry.java Sun Oct  4 22:49:30 2009
@@ -480,13 +480,17 @@
     public Collection<ObjectClassDescription> getObjectClassDescriptions()
     {
         Collection<ObjectClassDescription> ocds = new ArrayList<ObjectClassDescription>();
-        String[] ocNames = getAttribute( SchemaConstants.OBJECT_CLASS_AT ).getStringValues();
-        Schema schema = getBrowserConnection().getSchema();
-        for ( String ocName : ocNames )
+        IAttribute ocAttribute = getAttribute( SchemaConstants.OBJECT_CLASS_AT );
+        if ( ocAttribute != null )
         {
-            ObjectClassDescription ocd = schema.getObjectClassDescription( ocName );
-            ocds.add( ocd );
-        }
+            String[] ocNames = ocAttribute.getStringValues();
+            Schema schema = getBrowserConnection().getSchema();
+            for ( String ocName : ocNames )
+            {
+                ObjectClassDescription ocd = schema.getObjectClassDescription( ocName );
+                ocds.add( ocd );
+            }
+        }        
         return ocds;
     }