directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r627797 - /directory/shared/branches/bigbang/ldap/src/main/java/org/apache/directory/shared/ldap/name/RdnParser.java
Date Thu, 14 Feb 2008 16:37:23 GMT
Author: elecharny
Date: Thu Feb 14 08:37:18 2008
New Revision: 627797

URL: http://svn.apache.org/viewvc?rev=627797&view=rev
Log:
Fixed a potential NPE in RdnParser.

Modified:
    directory/shared/branches/bigbang/ldap/src/main/java/org/apache/directory/shared/ldap/name/RdnParser.java

Modified: directory/shared/branches/bigbang/ldap/src/main/java/org/apache/directory/shared/ldap/name/RdnParser.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/bigbang/ldap/src/main/java/org/apache/directory/shared/ldap/name/RdnParser.java?rev=627797&r1=627796&r2=627797&view=diff
==============================================================================
--- directory/shared/branches/bigbang/ldap/src/main/java/org/apache/directory/shared/ldap/name/RdnParser.java
(original)
+++ directory/shared/branches/bigbang/ldap/src/main/java/org/apache/directory/shared/ldap/name/RdnParser.java
Thu Feb 14 08:37:18 2008
@@ -907,6 +907,11 @@
      */
     public static int parse( byte[] dn, Position pos, Rdn rdn ) throws InvalidNameException
     {
+    	if ( rdn == null )
+    	{
+    		throw new InvalidNameException( "Cannot feed a null RDN structure" );
+    	}
+    	
         String type = null;
         Object value = null;
         int start = pos.start;
@@ -921,10 +926,7 @@
             return DNUtils.PARSING_ERROR;
         }
 
-        if ( rdn != null )
-        {
-            pos.start = pos.end;
-        }
+        pos.start = pos.end;
 
         StringTools.trimLeft( dn, pos );
 
@@ -946,14 +948,11 @@
             return DNUtils.PARSING_ERROR;
         }
 
-        if ( rdn != null )
-        {
-            rdn.addAttributeTypeAndValue( type, type, value, value );
-            rdn.normalize();
+        rdn.addAttributeTypeAndValue( type, type, value, value );
+        rdn.normalize();
 
-            pos.start = pos.end;
-            pos.length = 0;
-        }
+        pos.start = pos.end;
+        pos.length = 0;
 
         if ( parseNameComponents( dn, pos, rdn ) == DNUtils.PARSING_ERROR )
         {



Mime
View raw message