I create an instance of LDAPUrl using the constructor LDAPUrl (String url).
My LDAP URL "LDAP://127.0.0.1/?sn?sub?(|(cn=a*))" has attributes, but no DN.
During the parsing of the URL string the attributes are ignored.
In Version 1.4 of LDAPUrl.java, in Line 152, readNextConstruct(urlParser)
is called. In readNextConstruct() are two calls of StringTokenizer.nextToken().
This is correct if you have a DN. In this case the first call
returns the '?' and the next returns the attributes. But if you have
no DN (DN.equals("?") in Line 144) the first call returns the attributes
and the second retuns the '?' after the attributes.
My interpretation of RFC 2255 (LDAPv3 URL format) and 2253 (LDAPv3 DN
representation) is that the URL you mention has a zero length DN ("") which is
perfectly legal. So it does sound like a bug to me. Reassiging to Miodrag.
Rob thinks this is a bug because, one could consider the URL to represent the
root DSE. So the following: "LDAP://127.0.0.1/??base?(objectclass=*))"
should return all attributes of the root DSE, for example.
The bug has been fixed. In addition, the following problems have been fixed in
the LDAPUrl class:
1) Any value can be passed as search scope. If it is incorrect, it is simply
ignored, no exception.
2) If the filter part is not enclosed in (), it is silently ignored and the
defult one is used.
3) Some weird looking URLs are accepted like ldap:::host or
The fix has been cheked in 05-06-00 in the mozilla source tree.
Checking in ldapjdk/netscape/ldap/LDAPUrl.java;
/cvsroot/mozilla/directory/java-sdk/ldapjdk/netscape/ldap/LDAPUrl.java,v <-- L
new revision: 1.5; previous revision: 1.4