HTTPCLIENT-1416: Fixed NPE in CachingHttpClientBuilder#build()

git-svn-id: https://svn.apache.org/repos/asf/httpcomponents/httpclient/trunk@1529812 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Oleg Kalnichevski 2013-10-07 10:08:05 +00:00
parent b83c1b9358
commit df36e1087c
3 changed files with 15 additions and 2 deletions

View File

@ -1,3 +1,11 @@
Changes sicne 4.3.1
-------------------
* [HTTPCLIENT-1416] Fixed NPE in CachingHttpClientBuilder#build().
Contributed by Oleg Kalnichevski <olegk at apache.org>
Release 4.3.1
-------------------

View File

@ -107,9 +107,9 @@ public class CachingHttpClientBuilder extends HttpClientBuilder {
HttpCacheStorage storage = this.storage;
if (storage == null) {
if (this.cacheDir == null) {
storage = new BasicHttpCacheStorage(cacheConfig);
storage = new BasicHttpCacheStorage(config);
} else {
final ManagedHttpCacheStorage managedStorage = new ManagedHttpCacheStorage(cacheConfig);
final ManagedHttpCacheStorage managedStorage = new ManagedHttpCacheStorage(config);
addCloseable(managedStorage);
storage = managedStorage;
}

View File

@ -40,4 +40,9 @@ public class TestCachingHttpClientBuilder {
CachingHttpClientBuilder.create().setCacheConfig(cacheConfig).build();
}
@Test
public void testNullCacheConfig() throws Exception {
CachingHttpClientBuilder.create().setCacheConfig(null).build();
}
}