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

Expensive fillInStackTrace operation in HttpURLConnection.getOutputStream0 when no content-length in response

XMLWordPrintable

    • b25

        The following code in sun.net.www.protocol.http.HttpURLConnection.getOutputStream0 (https://github.com/openjdk/jdk/blob/master/src/java.base/share/classes/sun/net/www/protocol/http/HttpURLConnection.java#L1937):

                        try {
                            cl = Long.parseLong(responses.findValue("content-length"));
                        } catch (Exception exc) { };

        causes an expensive fillInStackTrace operation when "content-length" is missing in responses.

        We should check whether it is present before trying to parse it.

              jpai Jaikiran Pai
              eastigeevich Evgeny Astigeevich
              Votes:
              1 Vote for this issue
              Watchers:
              6 Start watching this issue

                Created:
                Updated:
                Resolved: