Return-Path: Delivered-To: apmail-directory-commits-archive@www.apache.org Received: (qmail 40128 invoked from network); 14 Feb 2008 16:37:49 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 14 Feb 2008 16:37:49 -0000 Received: (qmail 73006 invoked by uid 500); 14 Feb 2008 16:37:43 -0000 Delivered-To: apmail-directory-commits-archive@directory.apache.org Received: (qmail 72971 invoked by uid 500); 14 Feb 2008 16:37:43 -0000 Mailing-List: contact commits-help@directory.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@directory.apache.org Delivered-To: mailing list commits@directory.apache.org Received: (qmail 72960 invoked by uid 99); 14 Feb 2008 16:37:43 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 14 Feb 2008 08:37:43 -0800 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.3] (HELO eris.apache.org) (140.211.11.3) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 14 Feb 2008 16:37:05 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id 9168A1A9832; Thu, 14 Feb 2008 08:37:25 -0800 (PST) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit 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 -0000 To: commits@directory.apache.org From: elecharny@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20080214163725.9168A1A9832@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org 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 ) {