Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8285958

com.sun.jndi.toolkit.url.Uri threw MalformedURLException after CPU22_04

XMLWordPrintable

    • b05
    • generic
    • generic

      ADDITIONAL SYSTEM INFORMATION :
      Tested on various OS/Java versions and with the latest release the issue is present

      A DESCRIPTION OF THE PROBLEM :
      Documentation here https://www.oracle.com/java/technologies/javase/17-0-3-relnotes.html states that the Parsing of URL Strings is now defaulting to COMPAT instead of the legacy way, but the System property doesn't seem to allow the parsing to go into LEGACY mode.

      Our applications connect to an LDAP service using OID for discovery and there seems to be an issue with the
      com.sun.jndi.toolkit.url.Uri#parseCompat in that the DNS we are using has an underscore like so:
      ldap://test_oid:389

      com.sun.jndi.toolkit.url.Uri#parseCompat uses java.net.URI to parse the uri but there is a known issue with java.net.URI which calling java.net.URI.getHost() will return null because of the underscore in the hostname.

      There are probably a few ways to approach this but I do not know the history behind this one:
      1. Fix the issue so that -Dcom.sun.jndi.ldapURLParsing="legacy" actually sets the parsing mode
      2. Fix java.net.URI to be able to parse hostname with underscores
      3. Fix com.sun.jndi.toolkit.url.Uri#parseCompat to not use URI for getting the hostname
      4. We could change our DNS to not have underscores :) <- we are looking into this but I imagine other people will run into this problem


      REGRESSION : Last worked in version 11.0.15

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Have an ldap url which contains an underscore in the host name

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      Using -Dcom.sun.jndi.ldapURLParsing="legacy" we should be able to put the application in LEGACY parsing mode. This does not seem to be implemented and working it always stays in COMPAT

      ACTUAL -
      A DNS with an underscore will always fail in COMPAT parsing mode and setting -Dcom.sun.jndi.ldapURLParsing="legacy" seems to have no effect

      CUSTOMER SUBMITTED WORKAROUND :
      Fix our DNS so we can stay on the current versions of Java

      FREQUENCY : always


            dfuchs Daniel Fuchs
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved: