RFR 7133367: ResponseCache.put should not be called when setUseCaches(false)

chris hegarty chris.hegarty at oracle.com
Wed Feb 8 13:07:32 PST 2012


This seems to be an oversight in HttpURLConnection where the system-wide 
ResponseCache handler is used to store responses even if getUsesCaches 
returns false.

I guess this was never really noticed before since the cached response 
will not be used if getUsesCaches returns false for future requests.

The solution is to check if (cacheHandler != null && getUsesCaches()), 
similar to what is done during connect/plainConnect().

http://cr.openjdk.java.net/~chegar/7133367/webrev.00/webrev/

Thanks,
-Chris.



More information about the net-dev mailing list