You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by el...@apache.org on 2007/01/13 23:59:24 UTC
svn commit: r495994 -
/directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/name/Rdn.java
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 );
}
/**