Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8293590 Some syntax checks performed by URL.openConnection() could be performed earlier, at URL construction
  3. JDK-8295750

Release Note: URL constructors called with malformed input may throw MalformedURLException for cases where it wasn't thrown previously

    XMLWordPrintable

Details

    • Sub-task
    • Status: Resolved
    • P4
    • Resolution: Delivered
    • 20
    • 20
    • core-libs
    • b20
    • 20

    Description

      The parsing of input provided to the `java.net.URL` constructors has changed in this release to be more strict. If the URL constructors are called with malformed input then `MalformedURLException` may be thrown for cases where it wasn’t thrown previously.

      In previous releases, some of the parsing/validation performed by the JDK built-in `URLStreamHander` implementations was delayed until `URL::openConnection` or `URLConnection::connect` was called. Some of these parsing/validation are now performed early, within URL constructors. An exception caused by a malformed URL that would have been delayed until the connection was opened or connected might now cause a `MalformedURLException` to be thrown at URL construction time.

      This change only affects URL instances that delegate to JDK built in stream handler implementations.
      Only applications relying on JDK built-in stream handlers should be affected. Applications relying on custom third party `URLStreamHandler` implementations should remain unaffected.

      A new JDK specific system property `-Djdk.net.url.delayParsing` or `-Djdk.net.url.delayParsing=true` can be specified on the command line to revert to the previous behavior. By default, the property is not set, and the new behavior is in place. The property can be specified on the java command line if unexpected regressions are observed.

      This new property is provided for backward compatibility and may be removed in a future release.

      Attachments

        Activity

          People

            dfuchs Daniel Fuchs
            dfuchs Daniel Fuchs
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: