RFR 8011719: Properties.loadFromXML fails with a chunked HTTP connection
Chris Hegarty
chris.hegarty at oracle.com
Fri May 31 07:39:51 PDT 2013
HttpURLConnection returns various input streams, depending on the
response from the server. fixed content-length, chunked, error. Most, if
not all, are wrapped in an implementation specific HttpInputStream, to
correctly handle caching of responses. The issue reported by 8011719 is
that the close method of HttpInputStream throws an IOException if called
multiple times. The solution is to add a private boolean to
HttpInputStream to indicate whether the stream has been closed, or not.
This is very typical of these type of wrapper streams.
Also worth noting, the stream cannot be marked closed until near the end
of its close() method, since it needs to invoke read itself. Should not
be a problem as these streams are not thread-safe.
http://cr.openjdk.java.net/~chegar/8011719/webrev.00/webrev/
A test has been added to ensure correct behavior of the various
combinations of returned input streams.
-Chris.
More information about the net-dev
mailing list