Return-Path: X-Original-To: apmail-directory-commits-archive@www.apache.org Delivered-To: apmail-directory-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id DDA18912D for ; Wed, 3 Oct 2012 03:08:27 +0000 (UTC) Received: (qmail 27261 invoked by uid 500); 3 Oct 2012 03:08:27 -0000 Delivered-To: apmail-directory-commits-archive@directory.apache.org Received: (qmail 27144 invoked by uid 500); 3 Oct 2012 03:08:25 -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 27110 invoked by uid 99); 3 Oct 2012 03:08:23 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 03 Oct 2012 03:08:23 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.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; Wed, 03 Oct 2012 03:08:22 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id 65AD32388900 for ; Wed, 3 Oct 2012 03:07:39 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1393267 - /directory/shared/trunk/ldap/schema/data/src/main/java/org/apache/directory/shared/ldap/schemaloader/SchemaEntityFactory.java Date: Wed, 03 Oct 2012 03:07:39 -0000 To: commits@directory.apache.org From: elecharny@apache.org X-Mailer: svnmailer-1.0.8-patched Message-Id: <20121003030739.65AD32388900@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: elecharny Date: Wed Oct 3 03:07:38 2012 New Revision: 1393267 URL: http://svn.apache.org/viewvc?rev=1393267&view=rev Log: Added a hekper method to extract a String value from a Binary value Modified: directory/shared/trunk/ldap/schema/data/src/main/java/org/apache/directory/shared/ldap/schemaloader/SchemaEntityFactory.java Modified: directory/shared/trunk/ldap/schema/data/src/main/java/org/apache/directory/shared/ldap/schemaloader/SchemaEntityFactory.java URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/schema/data/src/main/java/org/apache/directory/shared/ldap/schemaloader/SchemaEntityFactory.java?rev=1393267&r1=1393266&r2=1393267&view=diff ============================================================================== --- directory/shared/trunk/ldap/schema/data/src/main/java/org/apache/directory/shared/ldap/schemaloader/SchemaEntityFactory.java (original) +++ directory/shared/trunk/ldap/schema/data/src/main/java/org/apache/directory/shared/ldap/schemaloader/SchemaEntityFactory.java Wed Oct 3 03:07:38 2012 @@ -1045,6 +1045,25 @@ public class SchemaEntityFactory impleme /** + * Return a String value, from teh given Valu, even if it's a binary value + */ + private String getStringValue( Attribute attribute ) + { + Value value = attribute.get(); + + if ( value instanceof BinaryValue ) + { + // We have to transform the value to a String + return Strings.utf8ToString( value.getBytes() ); + } + else + { + return value.getString(); + } + } + + + /** * Process the common attributes to all SchemaObjects : * - obsolete * - description @@ -1073,17 +1092,7 @@ public class SchemaEntityFactory impleme if ( mDescription != null ) { - Value value = mDescription.get(); - - if ( value instanceof BinaryValue ) - { - // We have to transform the value to a String - schemaObject.setDescription( Strings.utf8ToString( mDescription.getBytes() ) ); - } - else - { - schemaObject.setDescription( mDescription.getString() ); - } + schemaObject.setDescription( getStringValue( mDescription ) ); } // The names field