
|
If you were logged in you would be able to see more operations.
|
|
|
|
File Attachments:
|
|
|
Environment:
|
NA
|
|
| Resolution Date: |
25/Jun/06 07:52 PM
|
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 ) ;
}
|
|
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 ) ;
}
|
Show » |
made changes - 19/Mar/05 04:23 AM
| Field |
Original Value |
New Value |
|
Fix Version/s
|
|
0.9.0
[ 11004
]
|
made changes - 30/Mar/05 08:12 AM
|
Fix Version/s
|
0.9.0
[ 11004
]
|
|
|
Affects Version/s
|
0.9.1
[ 11126
]
|
|
|
Fix Version/s
|
|
0.9.1
[ 11126
]
|
made changes - 30/Mar/05 08:16 AM
|
Priority
|
Major
[ 3
]
|
Critical
[ 2
]
|
made changes - 16/Jun/05 03:05 PM
|
Fix Version/s
|
0.9.1
[ 11126
]
|
|
|
Resolution
|
|
Duplicate
[ 3
]
|
|
Status
|
Open
[ 1
]
|
Resolved
[ 5
]
|
made changes - 26/Sep/05 02:56 PM
|
Resolution
|
Duplicate
[ 3
]
|
|
|
Status
|
Resolved
[ 5
]
|
Reopened
[ 4
]
|
made changes - 07/Feb/06 02:40 PM
|
Affects Version/s
|
0.8.0
[ 11000
]
|
|
|
Affects Version/s
|
0.9.0
[ 11004
]
|
|
|
Project
|
Directory LDAP
[ 10514
]
|
ApacheDS
[ 12310260
]
|
|
Component/s
|
|
ldap
[ 12310715
]
|
|
Component/s
|
Common
[ 11085
]
|
|
|
Key
|
DIRLDAP-37
|
DIRSERVER-191
|
made changes - 12/Feb/06 06:57 PM
|
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 ) ;
}
|
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 ) ;
}
|
|
Fix Version/s
|
|
1.1.0
[ 12310790
]
|
made changes - 25/Jun/06 07:52 PM
|
Resolution
|
|
Fixed
[ 1
]
|
|
Status
|
Reopened
[ 4
]
|
Resolved
[ 5
]
|
made changes - 21/Apr/07 11:07 AM
|
Status
|
Resolved
[ 5
]
|
Closed
[ 6
]
|
|