directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From akaras...@apache.org
Subject svn commit: r153145 - in incubator/directory/apacheds/trunk/core/src/main/java/org/apache/ldap/server: db/jdbm/JdbmDatabase.java prefs/ServerPreferencesFactory.java prefs/ServerSystemPreferences.java
Date Thu, 10 Feb 2005 02:36:49 GMT
Author: akarasulu
Date: Wed Feb  9 18:36:48 2005
New Revision: 153145

URL: http://svn.apache.org/viewcvs?view=rev&rev=153145
Log:
fix npe due to lack of check for attribute and cleaned up javadocs

Modified:
    incubator/directory/apacheds/trunk/core/src/main/java/org/apache/ldap/server/db/jdbm/JdbmDatabase.java
    incubator/directory/apacheds/trunk/core/src/main/java/org/apache/ldap/server/prefs/ServerPreferencesFactory.java
    incubator/directory/apacheds/trunk/core/src/main/java/org/apache/ldap/server/prefs/ServerSystemPreferences.java

Modified: incubator/directory/apacheds/trunk/core/src/main/java/org/apache/ldap/server/db/jdbm/JdbmDatabase.java
URL: http://svn.apache.org/viewcvs/incubator/directory/apacheds/trunk/core/src/main/java/org/apache/ldap/server/db/jdbm/JdbmDatabase.java?view=diff&r1=153144&r2=153145
==============================================================================
--- incubator/directory/apacheds/trunk/core/src/main/java/org/apache/ldap/server/db/jdbm/JdbmDatabase.java
(original)
+++ incubator/directory/apacheds/trunk/core/src/main/java/org/apache/ldap/server/db/jdbm/JdbmDatabase.java
Wed Feb  9 18:36:48 2005
@@ -38,7 +38,9 @@
 import jdbm.recman.CacheRecordManager;
 import org.apache.ldap.common.MultiException;
 import org.apache.ldap.common.exception.LdapNameNotFoundException;
+import org.apache.ldap.common.exception.LdapSchemaViolationException;
 import org.apache.ldap.common.message.LockableAttributesImpl;
+import org.apache.ldap.common.message.ResultCodeEnum;
 import org.apache.ldap.common.name.LdapName;
 import org.apache.ldap.common.schema.AttributeType;
 import org.apache.ldap.common.schema.Normalizer;
@@ -682,13 +684,22 @@
         // don't keep going if we cannot find the parent Id
         if ( parentId == null )
         {
-            throw new LdapNameNotFoundException( "Id for parent '" +
-                    dn.getSuffix( 1 ).toString() + "' not found!" );
+            throw new LdapNameNotFoundException( "Id for parent '" + dn.getSuffix( 1 ).toString()
+ "' not found!" );
+        }
+
+        Attribute objectClass = entry.get( "objectClass" );
+
+        if ( objectClass == null )
+        {
+            String msg = "Entry " + updn + " contains no objectClass attribute: " + entry;
+
+            throw new LdapSchemaViolationException( msg, ResultCodeEnum.OBJECTCLASSVIOLATION
);
         }
 
         // Start adding the system indices
         // Why bother doing a lookup if this is not an alias.
-        if ( entry.get( "objectClass" ).contains( ALIAS_OBJECT ) ) 
+
+        if ( entry.get( "objectClass" ).contains( ALIAS_OBJECT ) )
         {
             addAliasIndices( id, dn, ( String ) entry.get( ALIAS_ATTRIBUTE ).get() );
         }

Modified: incubator/directory/apacheds/trunk/core/src/main/java/org/apache/ldap/server/prefs/ServerPreferencesFactory.java
URL: http://svn.apache.org/viewcvs/incubator/directory/apacheds/trunk/core/src/main/java/org/apache/ldap/server/prefs/ServerPreferencesFactory.java?view=diff&r1=153144&r2=153145
==============================================================================
--- incubator/directory/apacheds/trunk/core/src/main/java/org/apache/ldap/server/prefs/ServerPreferencesFactory.java
(original)
+++ incubator/directory/apacheds/trunk/core/src/main/java/org/apache/ldap/server/prefs/ServerPreferencesFactory.java
Wed Feb  9 18:36:48 2005
@@ -20,6 +20,7 @@
 import java.util.prefs.Preferences;
 import java.util.prefs.PreferencesFactory;
 
+
 import org.apache.ldap.common.NotImplementedException;
 
 

Modified: incubator/directory/apacheds/trunk/core/src/main/java/org/apache/ldap/server/prefs/ServerSystemPreferences.java
URL: http://svn.apache.org/viewcvs/incubator/directory/apacheds/trunk/core/src/main/java/org/apache/ldap/server/prefs/ServerSystemPreferences.java?view=diff&r1=153144&r2=153145
==============================================================================
--- incubator/directory/apacheds/trunk/core/src/main/java/org/apache/ldap/server/prefs/ServerSystemPreferences.java
(original)
+++ incubator/directory/apacheds/trunk/core/src/main/java/org/apache/ldap/server/prefs/ServerSystemPreferences.java
Wed Feb  9 18:36:48 2005
@@ -128,9 +128,9 @@
 
 
     /**
-     * Wrapps this Preferences object as a Dictionary.
+     * Wrapps this ServerPreferences object as a Dictionary.
      *
-     * @return a Dictionary that uses this Preferences object as the underlying backing store
+     * @return a Dictionary that uses this ServerPreferences object as the underlying backing
store
      */
     public Dictionary wrapAsDictionary()
     {
@@ -139,9 +139,9 @@
 
 
     /**
-     * Gets access to the LDAP context associated with this Preferences node.
+     * Gets access to the LDAP context associated with this ServerPreferences node.
      *
-     * @return the LDAP context associate with this Preferences node
+     * @return the LDAP context associate with this ServerPreferences node
      */
     LdapContext getLdapContext()
     {
@@ -150,10 +150,10 @@
 
 
     /**
-     * Sets up a new Preferences node by injecting the required information
+     * Sets up a new ServerPreferences node by injecting the required information
      * such as the node name attribute and the objectClass attribute.
      *
-     * @param name the name of the new Preferences node.
+     * @param name the name of the new ServerPreferences node.
      */
     private void setUpNode( String name ) throws NamingException
     {



Mime
View raw message