You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by fe...@apache.org on 2010/05/15 08:32:27 UTC

svn commit: r944579 - /directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/schema/registries/AbstractSchemaLoader.java

Author: felixk
Date: Sat May 15 06:32:27 2010
New Revision: 944579

URL: http://svn.apache.org/viewvc?rev=944579&view=rev
Log:
Make sure NPOE is thrown with the wanted params.

>From Findbugs
RCN: Nullcheck of value previously dereferenced (RCN_REDUNDANT_NULLCHECK_WOULD_HAVE_BEEN_A_NPE)

A value is checked here to see whether it is null, but this value can't be null because it was previously dereferenced and if it were null a null pointer exception would have occurred at the earlier dereference. Essentially, this code and the previous dereference disagree as to whether this value is allowed to be null. Either the check is redundant or the previous dereference is erroneous.

Modified:
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/schema/registries/AbstractSchemaLoader.java

Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/schema/registries/AbstractSchemaLoader.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/schema/registries/AbstractSchemaLoader.java?rev=944579&r1=944578&r2=944579&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/schema/registries/AbstractSchemaLoader.java (original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/schema/registries/AbstractSchemaLoader.java Sat May 15 06:32:27 2010
@@ -141,6 +141,11 @@ public abstract class AbstractSchemaLoad
 
     protected Schema getSchema( Entry entry ) throws Exception
     {
+        if ( entry == null )
+        {
+            throw new NullPointerException( I18n.err( I18n.ERR_04261 ) );
+        }
+
         EntryAttribute objectClasses = entry.get( SchemaConstants.OBJECT_CLASS_AT );
         boolean isSchema = false;
 
@@ -163,11 +168,6 @@ public abstract class AbstractSchemaLoad
         String[] dependencies = StringTools.EMPTY_STRINGS;
         boolean isDisabled = false;
 
-        if ( entry == null )
-        {
-            throw new NullPointerException( I18n.err( I18n.ERR_04261 ) );
-        }
-
         if ( entry.get( SchemaConstants.CN_AT ) == null )
         {
             throw new NullPointerException( I18n.err( I18n.ERR_04262 ) );