You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by dj...@apache.org on 2007/10/23 08:14:23 UTC
svn commit: r587398 -
/directory/shared/branches/bigbang/ldap/src/main/java/org/apache/directory/shared/ldap/name/LdapDN.java
Author: djencks
Date: Mon Oct 22 23:14:21 2007
New Revision: 587398
URL: http://svn.apache.org/viewvc?rev=587398&view=rev
Log:
Fix busted hashCode method and provide some comments on how the implementation appears to be backwards from the description, hopefully letting others avoid the hours of confusion I went through
Modified:
directory/shared/branches/bigbang/ldap/src/main/java/org/apache/directory/shared/ldap/name/LdapDN.java
Modified: directory/shared/branches/bigbang/ldap/src/main/java/org/apache/directory/shared/ldap/name/LdapDN.java
URL: http://svn.apache.org/viewvc/directory/shared/branches/bigbang/ldap/src/main/java/org/apache/directory/shared/ldap/name/LdapDN.java?rev=587398&r1=587397&r2=587398&view=diff
==============================================================================
--- directory/shared/branches/bigbang/ldap/src/main/java/org/apache/directory/shared/ldap/name/LdapDN.java (original)
+++ directory/shared/branches/bigbang/ldap/src/main/java/org/apache/directory/shared/ldap/name/LdapDN.java Mon Oct 22 23:14:21 2007
@@ -83,7 +83,11 @@
// ~ Static fields/initializers
// -----------------------------------------------------------------
- /** The RDNs that are elements of the DN */
+ /**
+ * The RDNs that are elements of the DN
+ * NOTE THAT THESE ARE IN THE OPPOSITE ORDER FROM THAT IMPLIED BY THE JAVADOC!
+ * Rdn[0] is rdns.get(n) and Rdn[n] is rdns.get(0)
+ */
protected List<Rdn> rdns = new ArrayList<Rdn>( 5 );
/** The user provided name */
@@ -493,7 +497,7 @@
{
int result = 17;
- if ( ( rdns != null ) && ( rdns.size() == 0 ) )
+ if ( ( rdns != null ) && ( rdns.size() != 0 ) )
{
for ( Rdn rdn : rdns )
{
@@ -772,7 +776,7 @@
/**
- * Retrieves the last component of this name.
+ * Retrieves the last (leaf) component of this name.
*
* @return the last component of this DN
*/
@@ -812,6 +816,7 @@
* Retrieves the components of this name as an enumeration of strings. The
* effect on the enumeration of updates to this name is undefined. If the
* name has zero components, an empty (non-null) enumeration is returned.
+ * This starts at the root (rightmost) rdn.
*
* @return an enumeration of the components of this name, each as string
*/
@@ -854,6 +859,7 @@
* Retrieves the components of this name as an enumeration of strings. The
* effect on the enumeration of updates to this name is undefined. If the
* name has zero components, an empty (non-null) enumeration is returned.
+ * This starts at the root (rightmost) rdn.
*
* @return an enumeration of the components of this name, as Rdn
*/
@@ -895,7 +901,8 @@
/**
* Creates a name whose components consist of a prefix of the components of
* this name. Subsequent changes to this name will not affect the name that
- * is returned and vice versa.
+ * is returned and vice versa. Note this includes the original root (rightmost rdn)
+ * and not the original leaf (leftmost rdn).
*
* @param posn
* the 0-based index of the component at which to stop. Must be
@@ -937,7 +944,8 @@
/**
* Creates a name whose components consist of a suffix of the components in
* this name. Subsequent changes to this name do not affect the name that is
- * returned and vice versa.
+ * returned and vice versa. This includes the original leaf (leftmost rdn)
+ * and not the orginal root (rightmost rdn)
*
* @param posn
* the 0-based index of the component at which to start. Must be
@@ -984,7 +992,7 @@
* components. Compoenents are supposed to be normalized.
*
* @param posn the index in this name at which to add the new components.
- * Must be in the range [0,size()].
+ * Must be in the range [0,size()]. Note this is from the opposite end as rnds.get(posn)
* @param name the components to add
* @return the updated name (not a new one)
* @throws ArrayIndexOutOfBoundsException
@@ -1041,7 +1049,7 @@
}
/**
- * Adds the components of a name -- in order -- to the end of this name.
+ * Adds the components of a name -- in order -- to the (leaf) end of this name.
*
* @param suffix
* the components to add
@@ -1067,7 +1075,7 @@
* components.
*
* @param posn the index in this name at which to add the new components.
- * Must be in the range [0,size()].
+ * Must be in the range [0,size()]. Note this is the from the opposite end as rdns.get(posn).
* @param name the components to add
* @return the updated name (not a new one)
* @throws ArrayIndexOutOfBoundsException
@@ -1128,7 +1136,7 @@
/**
- * Adds a single component to the end of this name.
+ * Adds a single component to the (leaf) end of this name.
*
* @param comp
* the component to add
@@ -1156,7 +1164,7 @@
/**
- * Adds a single RDN to the end of this name.
+ * Adds a single RDN to the (leaf) end of this name.
*
* @param newRdn the RDN to add
* @return the updated name (not a new one)
@@ -1172,7 +1180,7 @@
}
/**
- * Adds a single normalized RDN to the end of this name.
+ * Adds a single normalized RDN to the (leaf) end of this name.
*
* @param newRdn the RDN to add
* @return the updated name (not a new one)