Apache Directory Project - [jira] Reopened: (DIRLDAP-37) LdapName.getPrefix(int) does not return prefix.

This is Interesting: Free IT Magazines  
Home > Archive > Apache Directory Project > September 2005 > [jira] Reopened: (DIRLDAP-37) LdapName.getPrefix(int) does not return prefix.





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author [jira] Reopened: (DIRLDAP-37) LdapName.getPrefix(int) does not return prefix.
Trustin Lee (JIRA)

2005-09-26, 2:45 am

[ http://issues.apache.org/jira/brows...DAP-37?page=all ]

Trustin Lee reopened DIRLDAP-37:
--------------------------------


I guess this issue is not resolved right now? I'm reopening...

> LdapName.getPrefix(int) does not return prefix.
> -----------------------------------------------
>
> Key: DIRLDAP-37
> URL: http://issues.apache.org/jira/browse/DIRLDAP-37
> Project: Directory LDAP
> Type: Bug
> Components: Common
> Versions: 0.8.0, 0.9.0
> Environment: NA
> Reporter: Jacob S. Barrett
> Assignee: Alex Karasulu
> Priority: Critical
> Attachments: LdapName.patch, NameTest.java, NamespaceTools.patch, NamespaceToolsTest.java
>
> The JavaDoc for javax.naming.Name.getPrefix(int) [1] states that it returns "a name consisting of the components at indexes in the range [0,posn)." The implementation in org.apache.ldap.common.name.LdapName returns [size() - posn, size()). This is a s

uffix starting from the right like the getSuffix(int) which is a suffix from from the left. The correct implementation should return the prefix from the left to the specified position. Attached is the appropiate patch for LdapName.java and LdapNameTest.
java.
> References:
> 1) http://java.sun.com/j2se/1.4.2/docs....html#getPrefix(int)
> Patch:
> Index: shared/ldap/trunk/common/src/test/org/apache/ldap/common/name/LdapNameTest.java
> ========================================
===========================
> --- shared/ldap/trunk/common/src/test/org/apache/ldap/common/name/LdapNameTest.java (revision 158112)
> +++ shared/ldap/trunk/common/src/test/org/apache/ldap/common/name/LdapNameTest.java (working copy)
> @@ -545,10 +545,10 @@
> Name l_name =
> m_parser.parse( "cn=HomeDir,cn=John,ou=Marketing,ou=East" ) ;
> assertEquals( "", l_name.getPrefix( 0 ).toString() ) ;
> - assertEquals( "ou=East", l_name.getPrefix( 1 ).toString() ) ;
> - assertEquals( "ou=Marketing,ou=East",
> + assertEquals( "cn=HomeDir", l_name.getPrefix( 1 ).toString() ) ;
> + assertEquals( "cn=HomeDir,cn=John",
> l_name.getPrefix( 2 ).toString() ) ;
> - assertEquals( "cn=John,ou=Marketing,ou=East",
> + assertEquals( "cn=HomeDir,cn=John,ou=Marketing",
> l_name.getPrefix( 3 ).toString() ) ;
> assertEquals( "cn=HomeDir,cn=John,ou=Marketing,ou=East",
> l_name.getPrefix( 4 ).toString() ) ;
> Index: shared/ldap/trunk/common/src/java/org/apache/ldap/common/name/LdapName.java
> ========================================
===========================
> --- shared/ldap/trunk/common/src/java/org/apache/ldap/common/name/LdapName.java (revision 158112)
> +++ shared/ldap/trunk/common/src/java/org/apache/ldap/common/name/LdapName.java (working copy)
> @@ -327,7 +327,7 @@
> public Name getPrefix( int a_posn )
> {
> ArrayList list = new ArrayList();
> - list.addAll( m_list.subList( size() - a_posn, size() ) );
> + list.addAll( m_list.subList( 0, a_posn ) );
> return new LdapName( list ) ;
> }
>


--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://issues.apache.org/jira/secur...nistrators.jspa
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira


Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2008 webservertalk.com