HTTPCLIENT-1299: (regression) cache incorrectly disposes of the underlying cache resource when storing variant entry (follow-up)

Contributed by James Leigh <james at 3roundstones.com>

git-svn-id: https://svn.apache.org/repos/asf/httpcomponents/httpclient/trunk@1468823 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Oleg Kalnichevski 2013-04-17 10:18:48 +00:00
parent 5769675b15
commit 456461b1c6
3 changed files with 7 additions and 6 deletions

View File

@ -1,6 +1,10 @@
Changes since release 4.3 BETA1
-------------------
* [HTTPCLIENT-1299] (regression) cache incorrectly disposes of the underlying cache resource
when storing variant entry.
Contributed by James Leigh <james at 3roundstones.com>
* [HTTPCLIENT-1342] Redirects with underscore character in the location hostname cause
"java.lang.IllegalArgumentException: Host name may not be null".
Contributed by Oleg Kalnichevski <olegk at apache.org>

View File

@ -199,10 +199,9 @@ class BasicHttpCache implements HttpCache {
src = entry;
}
final Resource oldResource = entry.getResource();
Resource resource = null;
if (oldResource != null) {
resource = resourceFactory.copy(requestId, entry.getResource());
if (src.getResource() != null) {
resource = resourceFactory.copy(requestId, src.getResource());
}
final Map<String,String> variantMap = new HashMap<String,String>(src.getVariantMap());
variantMap.put(variantKey, variantCacheKey);

View File

@ -87,11 +87,9 @@ class CacheEntryUpdater {
Args.check(response.getStatusLine().getStatusCode() == HttpStatus.SC_NOT_MODIFIED,
"Response must have 304 status code");
final Header[] mergedHeaders = mergeHeaders(entry, response);
final Resource oldResource = entry.getResource();
Resource resource = null;
if (oldResource != null) {
if (entry.getResource() != null) {
resource = resourceFactory.copy(requestId, entry.getResource());
oldResource.dispose();
}
return new HttpCacheEntry(
requestDate,