directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r291943 - /directory/shared/ldap/branches/shared-ldap-NameComponent/apache2-provider/src/java/main/org/apache/asn1new/ldap/codec/primitives/LdapDN.java
Date Tue, 27 Sep 2005 13:59:16 GMT
Author: elecharny
Date: Tue Sep 27 06:59:11 2005
New Revision: 291943

URL: http://svn.apache.org/viewcvs?rev=291943&view=rev
Log:
Committed to be able to work at home

Modified:
    directory/shared/ldap/branches/shared-ldap-NameComponent/apache2-provider/src/java/main/org/apache/asn1new/ldap/codec/primitives/LdapDN.java

Modified: directory/shared/ldap/branches/shared-ldap-NameComponent/apache2-provider/src/java/main/org/apache/asn1new/ldap/codec/primitives/LdapDN.java
URL: http://svn.apache.org/viewcvs/directory/shared/ldap/branches/shared-ldap-NameComponent/apache2-provider/src/java/main/org/apache/asn1new/ldap/codec/primitives/LdapDN.java?rev=291943&r1=291942&r2=291943&view=diff
==============================================================================
--- directory/shared/ldap/branches/shared-ldap-NameComponent/apache2-provider/src/java/main/org/apache/asn1new/ldap/codec/primitives/LdapDN.java
(original)
+++ directory/shared/ldap/branches/shared-ldap-NameComponent/apache2-provider/src/java/main/org/apache/asn1new/ldap/codec/primitives/LdapDN.java
Tue Sep 27 06:59:11 2005
@@ -21,9 +21,7 @@
 import java.util.Iterator;
 
 import javax.naming.InvalidNameException;
-import javax.naming.Name;
 
-import org.apache.asn1.codec.DecoderException;
 import org.apache.asn1new.ldap.codec.utils.DNUtils;
 import org.apache.asn1new.util.StringUtils;
 
@@ -90,63 +88,11 @@
      * @param bytes The byte buffer that contains the DN
      * @exception A InvalidNameException is thrown if the buffer does not contains a valid
DN.
      */
-    public LdapDN( String string ) throws InvalidNameException
+    public LdapDN( String string ) throws InvalidNameException, UnsupportedEncodingException
     {
-        this( string.toCharArray() );
+		this( string.getBytes( "UTF-8" ) );
         
         name = string;
-        nameNormalized = normalize();
-    }
-    
-    /**
-     * Parse a buffer and checks that it is a valid DN <br>
-     * <p>
-     * &lt;distinguishedName&gt;     ::= &lt;name&gt; | e <br>
-     * &lt;name&gt;                ::= &lt;name-component&gt; &lt;name-components&gt;
<br>
-     * &lt;name-components&gt;    ::= &lt;spaces&gt; &lt;separator&gt;
&lt;spaces&gt; &lt;name-component&gt; &lt;name-components&gt; | e
<br>
-     * </p>
-     * 
-     * @param bytes The byte buffer that contains the DN
-     * @exception A InvalidNameException is thrown if the buffer does not contains a valid
DN.
-     */
-    public LdapDN( char[] chars ) throws InvalidNameException
-    {
-        if ( ( chars == null ) || ( chars.length == 0 ) )
-        {
-            return;
-        }
-        
-        int pos = 0;
-        LdapRDN rdn = new LdapRDN();
-
-        // <name>             ::= <name-component> <name-components>
-        // <name-components> ::= <spaces> <separator> <spaces> <name-component>
<name-components> | e
-        if ( ( pos = LdapRDN.parseNameComponent( chars, pos, rdn ) ) != DNUtils.PARSING_ERROR
)
-        {
-            do
-            {
-                rdns.add( rdn.clone() );
-                rdn.clear();
-
-                if ( ( StringUtils.isCharASCII( chars, pos, ',' ) == false ) &&
-                     ( StringUtils.isCharASCII( chars, pos, ';' ) == false ) )
-                {
-                    break;
-                }
-
-                chars[pos] = ',';
-                pos++;
-
-                pos = StringUtils.trimLeft( chars, pos );
-            }
-            while ( ( pos = LdapRDN.parseNameComponent( chars, pos, rdn ) ) != DNUtils.PARSING_ERROR
);
-        }
-        else
-        {
-            throw new InvalidNameException( "Bad DN : " + new String( chars ) );
-        }
-        
-        name = new String( chars );
         nameNormalized = normalize();
     }
     



Mime
View raw message