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:
parent
b83c1b9358
commit
df36e1087c
|
@ -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
|
Release 4.3.1
|
||||||
-------------------
|
-------------------
|
||||||
|
|
||||||
|
|
|
@ -107,9 +107,9 @@ public class CachingHttpClientBuilder extends HttpClientBuilder {
|
||||||
HttpCacheStorage storage = this.storage;
|
HttpCacheStorage storage = this.storage;
|
||||||
if (storage == null) {
|
if (storage == null) {
|
||||||
if (this.cacheDir == null) {
|
if (this.cacheDir == null) {
|
||||||
storage = new BasicHttpCacheStorage(cacheConfig);
|
storage = new BasicHttpCacheStorage(config);
|
||||||
} else {
|
} else {
|
||||||
final ManagedHttpCacheStorage managedStorage = new ManagedHttpCacheStorage(cacheConfig);
|
final ManagedHttpCacheStorage managedStorage = new ManagedHttpCacheStorage(config);
|
||||||
addCloseable(managedStorage);
|
addCloseable(managedStorage);
|
||||||
storage = managedStorage;
|
storage = managedStorage;
|
||||||
}
|
}
|
||||||
|
|
|
@ -40,4 +40,9 @@ public class TestCachingHttpClientBuilder {
|
||||||
CachingHttpClientBuilder.create().setCacheConfig(cacheConfig).build();
|
CachingHttpClientBuilder.create().setCacheConfig(cacheConfig).build();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testNullCacheConfig() throws Exception {
|
||||||
|
CachingHttpClientBuilder.create().setCacheConfig(null).build();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue