You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@directory.apache.org by "Jacob S. Barrett (JIRA)" <di...@incubator.apache.org> on 2005/03/18 19:59:21 UTC

[jira] Created: (DIRLDAP-37) LdapName.getPrefix(int) does not return prefix.

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, 0.8.1    
 Environment: NA
    Reporter: Jacob S. Barrett
 Assigned to: Alex Karasulu 


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 suffix 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/api/javax/naming/Name.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/secure/Administrators.jspa
-
If you want more information on JIRA, or have a bug to report see:
   http://www.atlassian.com/software/jira


[jira] Commented: (DIRLDAP-37) LdapName.getPrefix(int) does not return prefix.

Posted by "Alex Karasulu (JIRA)" <di...@incubator.apache.org>.
     [ http://issues.apache.org/jira/browse/DIRLDAP-37?page=comments#action_61754 ]
     
Alex Karasulu commented on DIRLDAP-37:
--------------------------------------

Jacob I could really use a patch file attachment and a JUnit test again.  Also would be nice to show how a JDK Name implementation behaves in comparison so we can see what's happening in the test case.  If you can get this to me soon I can cut the 0.9 release tarballs for all to test. Thanks.  

> 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, 0.9.1
>  Environment: NA
>     Reporter: Jacob S. Barrett
>     Assignee: Alex Karasulu
>      Fix For: 0.9.0

>
> 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 suffix 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/api/javax/naming/Name.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/secure/Administrators.jspa
-
If you want more information on JIRA, or have a bug to report see:
   http://www.atlassian.com/software/jira


[jira] Updated: (DIRLDAP-37) LdapName.getPrefix(int) does not return prefix.

Posted by "Alex Karasulu (JIRA)" <di...@incubator.apache.org>.
     [ http://issues.apache.org/jira/browse/DIRLDAP-37?page=history ]

Alex Karasulu updated DIRLDAP-37:
---------------------------------

        Version:     (was: 0.9.1)
    Fix Version: 0.9.1
                     (was: 0.9.0)

The bug with getSuffix is way serious and it drills down deep.  We've worked around the bug it seems.  Regardless 4 major classes depend on getSuffix working the wrong way:

org.apache.ldap.server.exceptionorg.apache.ldap.server.exception.ExceptionService
org.apache.ldap.server.jndi.ServerContext
org.org.apache.ldap.server.db.jdbm.JdbmDatabase
org.apache.ldap.seorg.apache.ldap.server.operational.OperationalAttributeService

This is going to require some serious testing to make sure we are not totally messing up the server.  Instead of taking this on before the next feature release I will leave it for 0.9.1 and handle it properly then.  Currently it is not producing a negative effect in the server so it should be ok.

> 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
>      Fix For: 0.9.1
>  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 suffix 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/api/javax/naming/Name.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/secure/Administrators.jspa
-
If you want more information on JIRA, or have a bug to report see:
   http://www.atlassian.com/software/jira


[jira] Resolved: (DIRLDAP-37) LdapName.getPrefix(int) does not return prefix.

Posted by "Alex Karasulu (JIRA)" <di...@incubator.apache.org>.
     [ http://issues.apache.org/jira/browse/DIRLDAP-37?page=all ]
     
Alex Karasulu resolved DIRLDAP-37:
----------------------------------

    Fix Version:     (was: 0.9.1)
     Resolution: Duplicate

Jacob points out DIRLDAP-112 supercedes this on.

> 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 suffix 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/api/javax/naming/Name.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/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


[jira] Updated: (DIRSERVER-191) LdapName.getPrefix(int) does not return prefix.

Posted by "Emmanuel Lecharny (JIRA)" <ji...@apache.org>.
     [ http://issues.apache.org/jira/browse/DIRSERVER-191?page=all ]

Emmanuel Lecharny updated DIRSERVER-191:
----------------------------------------

    Fix Version: 1.1.0
    Description: 
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 suffix 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/api/javax/naming/Name.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 ) ;
     }
 


  was:
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 suffix 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/api/javax/naming/Name.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 ) ;
     }
 



> LdapName.getPrefix(int) does not return prefix.
> -----------------------------------------------
>
>          Key: DIRSERVER-191
>          URL: http://issues.apache.org/jira/browse/DIRSERVER-191
>      Project: Directory ApacheDS
>         Type: Bug
>   Components: ldap
>  Environment: NA
>     Reporter: Jacob S. Barrett
>     Assignee: Alex Karasulu
>     Priority: Critical
>      Fix For: 1.1.0
>  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 suffix 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/api/javax/naming/Name.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/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


[jira] Resolved: (DIRSERVER-191) LdapName.getPrefix(int) does not return prefix.

Posted by "Emmanuel Lecharny (JIRA)" <ji...@apache.org>.
     [ http://issues.apache.org/jira/browse/DIRSERVER-191?page=all ]
     
Emmanuel Lecharny resolved DIRSERVER-191:
-----------------------------------------

    Resolution: Fixed

This issue has been solved a long time ago, but when?

Tests have been added into LdapDNTest class.

> LdapName.getPrefix(int) does not return prefix.
> -----------------------------------------------
>
>          Key: DIRSERVER-191
>          URL: http://issues.apache.org/jira/browse/DIRSERVER-191
>      Project: Directory ApacheDS
>         Type: Bug

>   Components: ldap
>  Environment: NA
>     Reporter: Jacob S. Barrett
>     Assignee: Alex Karasulu
>     Priority: Critical
>      Fix For: 1.1.0
>  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 suffix 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/api/javax/naming/Name.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/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


[jira] Updated: (DIRLDAP-37) LdapName.getPrefix(int) does not return prefix.

Posted by "Jacob S. Barrett (JIRA)" <di...@incubator.apache.org>.
     [ http://issues.apache.org/jira/browse/DIRLDAP-37?page=history ]

Jacob S. Barrett updated DIRLDAP-37:
------------------------------------

    Attachment: NameTest.java
                LdapName.patch

The patch fixes the backwards getSuffix() call and the attached file is JUnit that compare LdapName against the one in JDK 1.5.  The JUnit must be compiled and executed with the rt.jar from JDK 1.5.

> 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.9.1, 0.8.0, 0.9.0
>  Environment: NA
>     Reporter: Jacob S. Barrett
>     Assignee: Alex Karasulu
>      Fix For: 0.9.0
>  Attachments: LdapName.patch, NameTest.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 suffix 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/api/javax/naming/Name.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/secure/Administrators.jspa
-
If you want more information on JIRA, or have a bug to report see:
   http://www.atlassian.com/software/jira


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

Posted by "Trustin Lee (JIRA)" <di...@incubator.apache.org>.
     [ http://issues.apache.org/jira/browse/DIRLDAP-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 suffix 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/api/javax/naming/Name.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/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


[jira] Updated: (DIRLDAP-37) LdapName.getPrefix(int) does not return prefix.

Posted by "Jacob S. Barrett (JIRA)" <di...@incubator.apache.org>.
     [ http://issues.apache.org/jira/browse/DIRLDAP-37?page=history ]

Jacob S. Barrett updated DIRLDAP-37:
------------------------------------

    Attachment: NamespaceTools.patch
                NamespaceToolsTest.java

The patch fixes a bug introduced by fixing the getSuffix() in the previous patch.  In addition there is a JUnit to test this patch.

> 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
>      Fix For: 0.9.1
>  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 suffix 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/api/javax/naming/Name.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/secure/Administrators.jspa
-
If you want more information on JIRA, or have a bug to report see:
   http://www.atlassian.com/software/jira


[jira] Closed: (DIRSERVER-191) LdapName.getPrefix(int) does not return prefix.

Posted by "Emmanuel Lecharny (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/DIRSERVER-191?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Emmanuel Lecharny closed DIRSERVER-191.
---------------------------------------


Closing all issues created in 2005 and before which are marked resolved

> LdapName.getPrefix(int) does not return prefix.
> -----------------------------------------------
>
>                 Key: DIRSERVER-191
>                 URL: https://issues.apache.org/jira/browse/DIRSERVER-191
>             Project: Directory ApacheDS
>          Issue Type: Bug
>          Components: ldap
>         Environment: NA
>            Reporter: Jacob S. Barrett
>         Assigned To: Alex Karasulu
>            Priority: Critical
>             Fix For: 1.5.0
>
>         Attachments: LdapName.patch, NamespaceTools.patch, NamespaceToolsTest.java, NameTest.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 suffix 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/api/javax/naming/Name.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.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (DIRLDAP-37) LdapName.getPrefix(int) does not return prefix.

Posted by "Alex Karasulu (JIRA)" <di...@incubator.apache.org>.
     [ http://issues.apache.org/jira/browse/DIRLDAP-37?page=history ]

Alex Karasulu updated DIRLDAP-37:
---------------------------------

    Priority: Critical  (was: Major)

Increasing criticality - making sure I'm going to take care of this right after the 0.9 release.

> 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
>      Fix For: 0.9.1
>  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 suffix 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/api/javax/naming/Name.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/secure/Administrators.jspa
-
If you want more information on JIRA, or have a bug to report see:
   http://www.atlassian.com/software/jira