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 2006/08/20 22:23:18 UTC
svn commit: r433027 -
/directory/branches/shared/0.9.5/ldap/src/main/java/org/apache/directory/shared/ldap/name/LdapDnParser.java
Author: elecharny
Date: Sun Aug 20 13:23:18 2006
New Revision: 433027
URL: http://svn.apache.org/viewvc?rev=433027&view=rev
Log:
Seems to be just some reformating
Modified:
directory/branches/shared/0.9.5/ldap/src/main/java/org/apache/directory/shared/ldap/name/LdapDnParser.java
Modified: directory/branches/shared/0.9.5/ldap/src/main/java/org/apache/directory/shared/ldap/name/LdapDnParser.java
URL: http://svn.apache.org/viewvc/directory/branches/shared/0.9.5/ldap/src/main/java/org/apache/directory/shared/ldap/name/LdapDnParser.java?rev=433027&r1=433026&r2=433027&view=diff
==============================================================================
--- directory/branches/shared/0.9.5/ldap/src/main/java/org/apache/directory/shared/ldap/name/LdapDnParser.java (original)
+++ directory/branches/shared/0.9.5/ldap/src/main/java/org/apache/directory/shared/ldap/name/LdapDnParser.java Sun Aug 20 13:23:18 2006
@@ -60,104 +60,106 @@
* [\"] <br> - <separator> ::= ',' | ';' <br> - <spaces> ::= ' '
* <spaces> | e <br>
* </p>
- *
+ *
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
*/
public class LdapDnParser implements NameParser
{
- private static LdapDnParser instance = new LdapDnParser();
+ private static LdapDnParser instance = new LdapDnParser();
- /**
- * A private constructor. It's useless, as this object is totally stateless,
- * but we need to expose a NameParser.
- */
- private LdapDnParser()
- {
- }
-
-
- /**
- * Get a reference to the NameParser. Needed to be compliant with the JNDI
- * API
- *
- * @return An instance of the NameParser
- */
- public static NameParser getNameParser()
- {
- return instance;
- }
-
-
- /**
- * Parse a DN
- *
- * @param dn
- * The DN to be parsed
- * @param rdns
- * The list that will contain the RDNs
- * @throws InvalidNameException
- * If the DN is invalid
- */
- public static void parseInternal( String dn, List rdns ) throws InvalidNameException
- {
- if ( dn.length() == 0 )
- {
- // We have an empty DN, just get out of the function.
- return;
- }
-
- Position pos = new Position();
- pos.start = 0;
- Rdn rdn = new Rdn();
-
- // <name> ::= <name-component> <name-components>
- // <name-components> ::= <spaces> <separator> <spaces> <name-component>
- // <name-components> | e
- if ( RdnParser.parse( dn, pos, rdn ) != DNUtils.PARSING_ERROR )
- {
- // Now, parse the following nameComponents
- do
- {
- rdns.add( rdn );
- rdn = new Rdn();
-
- if ( ( StringTools.isCharASCII( dn, pos.start, ',' ) == false )
- && ( StringTools.isCharASCII( dn, pos.start, ';' ) == false ) )
- {
-
- if ( pos.start != dn.length() )
- {
- throw new InvalidNameException( "Bad DN : " + dn );
- }
- else
- {
- break;
- }
- }
-
- pos.start++;
- }
- while ( RdnParser.parse( dn, pos, rdn ) != DNUtils.PARSING_ERROR );
- }
- else
- {
- throw new InvalidNameException( "Bad DN : " + dn );
- }
- }
-
-
- /**
- * Parse a String and return a LdapDN if the String is a valid DN
- *
- * @param dn
- * The DN to parse
- * @return A LdapDN
- * @throws InvalidNameException
- * If the String is not a valid DN
- */
- public Name parse( String dn ) throws InvalidNameException
- {
- return new LdapDN( dn );
- }
+ /**
+ * A private constructor. It's useless, as this object is totally stateless,
+ * but we need to expose a NameParser.
+ */
+ private LdapDnParser()
+ {
+ }
+
+
+ /**
+ * Get a reference to the NameParser. Needed to be compliant with the JNDI
+ * API
+ *
+ * @return An instance of the NameParser
+ */
+ public static NameParser getNameParser()
+ {
+ return instance;
+ }
+
+
+ /**
+ * Parse a DN
+ *
+ * @param dn
+ * The DN to be parsed
+ * @param rdns
+ * The list that will contain the RDNs
+ * @throws InvalidNameException
+ * If the DN is invalid
+ */
+ public static void parseInternal( String dn, List rdns ) throws InvalidNameException
+ {
+ if ( dn.length() == 0 )
+ {
+ // We have an empty DN, just get out of the function.
+ return;
+ }
+
+ Position pos = new Position();
+ pos.start = 0;
+ Rdn rdn = new Rdn();
+
+ // <name> ::= <name-component> <name-components>
+ // <name-components> ::= <spaces> <separator> <spaces> <name-component>
+ // <name-components> | e
+ if ( RdnParser.parse( dn, pos, rdn ) != DNUtils.PARSING_ERROR )
+ {
+ // Now, parse the following nameComponents
+ do
+ {
+ rdns.add( rdn );
+ rdn = new Rdn();
+
+ if ( ( StringTools.isCharASCII( dn, pos.start, ',' ) == false )
+ && ( StringTools.isCharASCII( dn, pos.start, ';' ) == false ) )
+ {
+
+ if ( pos.start != dn.length() )
+ {
+ throw new InvalidNameException( "Bad DN : " + dn );
+ }
+ else
+ {
+ break;
+ }
+ }
+
+ pos.start++;
+ }
+ while ( RdnParser.parse( dn, pos, rdn ) != DNUtils.PARSING_ERROR );
+ }
+ else
+ {
+ throw new InvalidNameException( "Bad DN : " + dn );
+ }
+ }
+
+
+ /**
+ * Parse a String and return a LdapDN if the String is a valid DN
+ *
+ * @param dn
+ * The DN to parse
+ * @return A LdapDN
+ * @throws InvalidNameException
+ * If the String is not a valid DN
+ */
+ public Name parse( String dn ) throws InvalidNameException
+ {
+ return new LdapDN( dn );
+ }
}
+
+