Return-Path: Delivered-To: apmail-directory-commits-archive@www.apache.org Received: (qmail 44746 invoked from network); 2 Oct 2010 22:01:58 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 2 Oct 2010 22:01:58 -0000 Received: (qmail 26898 invoked by uid 500); 2 Oct 2010 22:01:58 -0000 Delivered-To: apmail-directory-commits-archive@directory.apache.org Received: (qmail 26833 invoked by uid 500); 2 Oct 2010 22:01:58 -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 26826 invoked by uid 99); 2 Oct 2010 22:01:58 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 02 Oct 2010 22:01:58 +0000 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.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 02 Oct 2010 22:01:55 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id 8A5D72388A38; Sat, 2 Oct 2010 22:01:34 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1003897 - /directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/entry/DefaultEntry.java Date: Sat, 02 Oct 2010 22:01:34 -0000 To: commits@directory.apache.org From: elecharny@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20101002220134.8A5D72388A38@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: elecharny Date: Sat Oct 2 22:01:34 2010 New Revision: 1003897 URL: http://svn.apache.org/viewvc?rev=1003897&view=rev Log: o Fixed some findbugs issues Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/entry/DefaultEntry.java Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/entry/DefaultEntry.java URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/entry/DefaultEntry.java?rev=1003897&r1=1003896&r2=1003897&view=diff ============================================================================== --- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/entry/DefaultEntry.java (original) +++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/entry/DefaultEntry.java Sat Oct 2 22:01:34 2010 @@ -112,7 +112,7 @@ public class DefaultEntry implements Ent dn = DN.EMPTY_DN; // Initialize the ObjectClass object - initObjectClassAT( schemaManager ); + initObjectClassAT(); } @@ -141,6 +141,8 @@ public class DefaultEntry implements Ent */ public DefaultEntry( SchemaManager schemaManager, DN dn ) { + this.schemaManager = schemaManager; + if ( dn == null ) { this.dn = DN.EMPTY_DN; @@ -148,14 +150,11 @@ public class DefaultEntry implements Ent else { this.dn = dn; + normalizeDN( this.dn ); } - this.schemaManager = schemaManager; - - normalizeDN( dn ); - // Initialize the ObjectClass object - initObjectClassAT( schemaManager ); + initObjectClassAT(); } @@ -195,20 +194,19 @@ public class DefaultEntry implements Ent this.schemaManager = schemaManager; // Initialize the ObjectClass object - initObjectClassAT( schemaManager ); + initObjectClassAT(); // We will clone the existing entry, because it may be normalized if ( entry.getDn() != null ) { dn = entry.getDn(); + normalizeDN( dn ); } else { dn = DN.EMPTY_DN; } - normalizeDN( dn ); - // Init the attributes map attributes = new HashMap( entry.size() ); @@ -255,6 +253,8 @@ public class DefaultEntry implements Ent */ public DefaultEntry( SchemaManager schemaManager, DN dn, String... upIds ) { + this.schemaManager = schemaManager; + if ( dn == null ) { this.dn = DN.EMPTY_DN; @@ -262,13 +262,10 @@ public class DefaultEntry implements Ent else { this.dn = dn; + normalizeDN( this.dn ); } - this.schemaManager = schemaManager; - - normalizeDN( dn ); - - initObjectClassAT( schemaManager ); + initObjectClassAT(); set( upIds ); } @@ -315,6 +312,8 @@ public class DefaultEntry implements Ent */ public DefaultEntry( SchemaManager schemaManager, DN dn, EntryAttribute... attributes ) { + this.schemaManager = schemaManager; + if ( dn == null ) { this.dn = DN.EMPTY_DN; @@ -322,13 +321,10 @@ public class DefaultEntry implements Ent else { this.dn = dn; + normalizeDN( this.dn ); } - this.schemaManager = schemaManager; - - normalizeDN( dn ); - - initObjectClassAT( schemaManager ); + initObjectClassAT(); for ( EntryAttribute attribute : attributes ) { @@ -364,6 +360,8 @@ public class DefaultEntry implements Ent */ public DefaultEntry( SchemaManager schemaManager, DN dn, AttributeType... attributeTypes ) { + this.schemaManager = schemaManager; + if ( dn == null ) { this.dn = DN.EMPTY_DN; @@ -371,14 +369,11 @@ public class DefaultEntry implements Ent else { this.dn = dn; + normalizeDN( this.dn ); } - this.schemaManager = schemaManager; - - normalizeDN( dn ); - // Initialize the ObjectClass object - initObjectClassAT( schemaManager ); + initObjectClassAT(); // Add the attributeTypes set( attributeTypes ); @@ -408,6 +403,8 @@ public class DefaultEntry implements Ent */ public DefaultEntry( SchemaManager schemaManager, DN dn, AttributeType attributeType, String upId ) { + this.schemaManager = schemaManager; + if ( dn == null ) { this.dn = DN.EMPTY_DN; @@ -415,14 +412,11 @@ public class DefaultEntry implements Ent else { this.dn = dn; + normalizeDN( dn ); } - this.schemaManager = schemaManager; - - normalizeDN( dn ); - // Initialize the ObjectClass object - initObjectClassAT( schemaManager ); + initObjectClassAT(); try { @@ -452,7 +446,7 @@ public class DefaultEntry implements Ent */ // This will suppress PMD.EmptyCatchBlock warnings in this method @SuppressWarnings("PMD.EmptyCatchBlock") - private void initObjectClassAT( SchemaManager schemaManager ) + private void initObjectClassAT() { try { @@ -471,7 +465,7 @@ public class DefaultEntry implements Ent } - private String getId( String upId ) throws IllegalArgumentException + private String getId( String upId ) { String id = StringTools.trim( StringTools.toLowerCase( upId ) ); @@ -489,8 +483,10 @@ public class DefaultEntry implements Ent /** * Get the UpId if it was null. + * + * @param upId The ID */ - public static String getUpId( String upId, AttributeType attributeType ) + private static String getUpId( String upId, AttributeType attributeType ) { String normUpId = StringTools.trim( upId );