directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r495994 - /directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/name/Rdn.java
Date Sat, 13 Jan 2007 22:59:24 GMT
Author: elecharny
Date: Sat Jan 13 14:59:24 2007
New Revision: 495994

URL: http://svn.apache.org/viewvc?view=rev&rev=495994
Log:
Modified the escapeValue() method to accept either String or byte[]

Modified:
    directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/name/Rdn.java

Modified: directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/name/Rdn.java
URL: http://svn.apache.org/viewvc/directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/name/Rdn.java?view=diff&rev=495994&r1=495993&r2=495994
==============================================================================
--- directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/name/Rdn.java
(original)
+++ directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/name/Rdn.java
Sat Jan 13 14:59:24 2007
@@ -1067,19 +1067,16 @@
    /**
     * Transform a value in a String, accordingly to RFC 2253
     *
-    * @param attrValue
-    *            The attribute value to be escaped
+    * @param value The attribute value to be escaped
     * @return The escaped string value.
     */
-   public static String escapeValue( Object attrValue )
+   public static String escapeValue( String value )
    {
-       if ( StringTools.isEmpty( ( byte[] ) attrValue ) )
+       if ( StringTools.isEmpty( value ) )
        {
            return "";
        }
-
-       String value = StringTools.utf8ToString( ( byte[] ) attrValue );
-
+       
        char[] chars = value.toCharArray();
        char[] newChars = new char[chars.length * 3];
        int pos = 0;
@@ -1157,6 +1154,25 @@
        }
 
        return new String( newChars, 0, pos );
+   }
+   
+   /**
+    * Transform a value in a String, accordingly to RFC 2253
+    *
+    * @param attrValue
+    *            The attribute value to be escaped
+    * @return The escaped string value.
+    */
+   public static String escapeValue( byte[] attrValue )
+   {
+       if ( StringTools.isEmpty( attrValue ) )
+       {
+           return "";
+       }
+
+       String value = StringTools.utf8ToString( attrValue );
+       
+       return escapeValue( value );
    }
 
    /**



Mime
View raw message