JDK-8074761 : Empty optional parameters of LDAP query are not interpreted as empty
  • Type: Bug
  • Component: core-libs
  • Sub-Component: javax.naming
  • Affected Version: 8,9
  • Priority: P4
  • Status: Closed
  • Resolution: Fixed
  • Submitted: 2015-03-09
  • Updated: 2016-08-24
  • Resolved: 2015-04-23
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 8 JDK 9
8u60Fixed 9 b62Fixed
Description
RFC2255 [1] allows any of attribute, scope, filter and extension to be empty. Code in com.sun.jndi.ldap package expects empty values to be represented by null, but LdapURL parsing method leaves optional parameters as "" (empty string).

Test URL: ldap://localhost:10389/ou=RefPeople,dc=example,dc=com????

Expected result:
ldapUrl.getAttributes() == null
ldapUrl.getFilter() == null
ldapUrl.getScope() == null
ldapUrl.getExtension() == null

Actual result:
ldapUrl.getAttributes() == ""
ldapUrl.getFilter() == ""
ldapUrl.getScope() == ""
ldapUrl.getExtension() == ""

[1] https://tools.ietf.org/html/rfc2255#section-3
Comments
I filed this bug on behalf of Stanislav Baiduzhyi who has posted a patch here: http://mail.openjdk.java.net/pipermail/core-libs-dev/2015-March/032179.html
20-04-2015