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

com.sun.net.httpserver.HttpExchange should implement AutoCloseable

XMLWordPrintable

    • Icon: CSR CSR
    • Resolution: Approved
    • Icon: P5 P5
    • 14
    • core-libs
    • None
    • source
    • minimal
    • Java API
    • JDK

      Summary

      HttpExchange to implement AutoCloseable so that it can be used with try-with-resources statements.

      Problem

      HttpExchange has a close() method but does not implement AutoCloseable for try-with-resources.

      Solution

      Retrofit HttpExchange to implement AutoCloseable.

      Specification

      --- a/src/jdk.httpserver/share/classes/com/sun/net/httpserver/HttpExchange.java Wed Aug 07 10:29:07 2019 +0200
      +++ b/src/jdk.httpserver/share/classes/com/sun/net/httpserver/HttpExchange.java Wed Aug 07 16:01:49 2019 +0100
      @@ -64,7 +64,7 @@
        * @since 1.6
        */
      
      -public abstract class HttpExchange {
      +public abstract class HttpExchange implements AutoCloseable {
      
           protected HttpExchange () {
           }

            pconcannon Patrick Concannon (Inactive)
            webbuggrp Webbug Group
            Michael McMahon
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: