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 2005/04/03 19:28:44 UTC
svn commit: r159936 -
directory/sandbox/trunk/asn1-new-codec/src/java/org/apache/asn1/ldap/codec/primitives/LdapDNDecoder.java
Author: elecharny
Date: Sun Apr 3 10:28:43 2005
New Revision: 159936
URL: http://svn.apache.org/viewcvs?view=rev&rev=159936
Log:
Used a MutableString instead of a simple String.
Modified:
directory/sandbox/trunk/asn1-new-codec/src/java/org/apache/asn1/ldap/codec/primitives/LdapDNDecoder.java
Modified: directory/sandbox/trunk/asn1-new-codec/src/java/org/apache/asn1/ldap/codec/primitives/LdapDNDecoder.java
URL: http://svn.apache.org/viewcvs/directory/sandbox/trunk/asn1-new-codec/src/java/org/apache/asn1/ldap/codec/primitives/LdapDNDecoder.java?view=diff&r1=159935&r2=159936
==============================================================================
--- directory/sandbox/trunk/asn1-new-codec/src/java/org/apache/asn1/ldap/codec/primitives/LdapDNDecoder.java (original)
+++ directory/sandbox/trunk/asn1-new-codec/src/java/org/apache/asn1/ldap/codec/primitives/LdapDNDecoder.java Sun Apr 3 10:28:43 2005
@@ -16,11 +16,11 @@
*/
package org.apache.asn1.ldap.codec.primitives;
-import java.io.UnsupportedEncodingException;
-
import org.apache.asn1.ber.tlv.Value;
import org.apache.asn1.ldap.codec.DecoderException;
import org.apache.asn1.ldap.codec.utils.LdapDN;
+import org.apache.asn1.util.MutableString;
+import org.apache.asn1.util.pools.PoolManager;
/**
@@ -35,25 +35,14 @@
/**
* Transform the byte array to a String. A check is done to insure that
* it complies with RFC 2044.
- *
+ *
+ * @param pool The poolmanager that will allocate a MutableString
* @param value The byte array to transform
* @return A String that represent the LDAPString
* @throws DecoderException If the byte array does not comply with RFC 2044
*/
- public static String parse( Value value ) throws DecoderException
+ public static MutableString parse( PoolManager pool, Value value ) throws DecoderException
{
- try
- {
- byte[] data = value.getData();
- String text = new String(data, "UTF-8");
- char[] chars = new char[text.length()];
- text.getChars(0, data.length, chars, 0);
-
- return LdapDN.parseDN( chars );
- }
- catch (UnsupportedEncodingException uee)
- {
- throw new DecoderException("Error while decoding the string");
- }
+ return LdapDN.parseDN( pool, value.getData() );
}
}