directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pamarce...@apache.org
Subject svn commit: r1245599 - /directory/shared/trunk/ldap/codec/core/src/main/java/org/apache/directory/shared/ldap/codec/api/DefaultConfigurableBinaryAttributeDetector.java
Date Fri, 17 Feb 2012 15:08:31 GMT
Author: pamarcelot
Date: Fri Feb 17 15:08:31 2012
New Revision: 1245599

URL: http://svn.apache.org/viewvc?rev=1245599&view=rev
Log:
Fixed a bug where the list initialized with default values was not cleared when setting a
new list of binary attributes.

Modified:
    directory/shared/trunk/ldap/codec/core/src/main/java/org/apache/directory/shared/ldap/codec/api/DefaultConfigurableBinaryAttributeDetector.java

Modified: directory/shared/trunk/ldap/codec/core/src/main/java/org/apache/directory/shared/ldap/codec/api/DefaultConfigurableBinaryAttributeDetector.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/codec/core/src/main/java/org/apache/directory/shared/ldap/codec/api/DefaultConfigurableBinaryAttributeDetector.java?rev=1245599&r1=1245598&r2=1245599&view=diff
==============================================================================
--- directory/shared/trunk/ldap/codec/core/src/main/java/org/apache/directory/shared/ldap/codec/api/DefaultConfigurableBinaryAttributeDetector.java
(original)
+++ directory/shared/trunk/ldap/codec/core/src/main/java/org/apache/directory/shared/ldap/codec/api/DefaultConfigurableBinaryAttributeDetector.java
Fri Feb 17 15:08:31 2012
@@ -19,11 +19,13 @@
  */
 package org.apache.directory.shared.ldap.codec.api;
 
+
 import java.util.Set;
 
 import org.apache.directory.shared.util.Strings;
 import org.apache.mina.util.ConcurrentHashSet;
 
+
 /**
  * An implementation of the BinaryAttributeDetector interface. It's used
  * on the client side to detect if an Attribute is HumanRedable.<br/>
@@ -65,36 +67,37 @@ public class DefaultConfigurableBinaryAt
 {
     /** A set of binary Attribute ID */
     private Set<String> binaryAttributes = new ConcurrentHashSet<String>();
-    
+
     /** A list of all the known binary attributes */
     public final static String[] DEFAULT_BINARY_ATTRIBUTES = new String[]
         {
-            "entryACI",                 // Syntax : ACI Item
-            "prescriptiveACI",          // Syntax : ACI Item
-            "subentryACI",              // Syntax : ACI Item
-            "audio",                    // Syntax : Audio
-            "javaByteCode",             // Syntax : Binary
-            "javaClassByteCode",        // Syntax : Binary
-            "krb5key",                  // Syntax : Binary
-            "m-byteCode",               // Syntax : Binary
-            "privateKey",               // Syntax : Binary
-            "publicKey",                // Syntax : Binary
-            "userPKCS12",               // Syntax : Binary
-            "userSMIMECertificate",     // Syntax : Binary
-            "cACertificate",            // Syntax : Certificate
-            "userCertificate",          // Syntax : Certificate
-            "authorityRevocationList",  // Syntax : Certificate List
+            "entryACI", // Syntax : ACI Item
+            "prescriptiveACI", // Syntax : ACI Item
+            "subentryACI", // Syntax : ACI Item
+            "audio", // Syntax : Audio
+            "javaByteCode", // Syntax : Binary
+            "javaClassByteCode", // Syntax : Binary
+            "krb5key", // Syntax : Binary
+            "m-byteCode", // Syntax : Binary
+            "privateKey", // Syntax : Binary
+            "publicKey", // Syntax : Binary
+            "userPKCS12", // Syntax : Binary
+            "userSMIMECertificate", // Syntax : Binary
+            "cACertificate", // Syntax : Certificate
+            "userCertificate", // Syntax : Certificate
+            "authorityRevocationList", // Syntax : Certificate List
             "certificateRevocationList",// Syntax : Certificate List
-            "deltaRevocationList",      // Syntax : Certificate List
-            "crossCertificatePair",     // Syntax : Certificate Pair
-            "personalSignature",        // Syntax : Fax
-            "photo",                    // Syntax : Fax
-            "jpegPhoto",                // Syntax : JPEG
-            "supportedAlgorithms",      // Syntax : Supported Algorithm
-            "javaSerializedData",       // Syntax : Octet String
-            "userPassword"              // Syntax : Octet String
+            "deltaRevocationList", // Syntax : Certificate List
+            "crossCertificatePair", // Syntax : Certificate Pair
+            "personalSignature", // Syntax : Fax
+            "photo", // Syntax : Fax
+            "jpegPhoto", // Syntax : JPEG
+            "supportedAlgorithms", // Syntax : Supported Algorithm
+            "javaSerializedData", // Syntax : Octet String
+            "userPassword" // Syntax : Octet String
         };
-    
+
+
     /**
      * Creates a new instance of a ConfigurableBinaryAttributeDetector. This will
      * load a set of default attribute ID that are known to be binary.
@@ -103,15 +106,15 @@ public class DefaultConfigurableBinaryAt
     {
         setBinaryAttributes( DEFAULT_BINARY_ATTRIBUTES );
     }
-    
-    
+
+
     /**
      * {@inheritDoc}
      */
     public boolean isBinary( String attributeId )
     {
         boolean isBinary = super.isBinary( attributeId );
-        
+
         if ( isBinary )
         {
             return true;
@@ -121,7 +124,7 @@ public class DefaultConfigurableBinaryAt
 
         return binaryAttributes.contains( attrId );
     }
-    
+
 
     /**
      * {@inheritDoc}
@@ -137,7 +140,7 @@ public class DefaultConfigurableBinaryAt
             }
         }
     }
-    
+
 
     /**
      * {@inheritDoc}
@@ -153,26 +156,22 @@ public class DefaultConfigurableBinaryAt
             }
         }
     }
-    
+
 
     /**
      * {@inheritDoc}
      */
     public void setBinaryAttributes( String... binaryAttributes )
     {
+        this.binaryAttributes.clear();
+
+        // Special case for 'null'
         if ( binaryAttributes == null )
         {
-            // Clear the Set and reinject the default attributes
-            this.binaryAttributes.clear();
-            setBinaryAttributes( DEFAULT_BINARY_ATTRIBUTES );
-            
-            return;
+            // Reseting to the default list of binary attributes
+            binaryAttributes = DEFAULT_BINARY_ATTRIBUTES;
         }
 
-        for ( String binaryAttribute : binaryAttributes )
-        {
-            String attrId = Strings.toLowerCase( binaryAttribute );
-            this.binaryAttributes.add( attrId );
-        }
+        addBinaryAttribute( binaryAttributes );
     }
 }



Mime
View raw message