Use Asserts to verify object state (follow-up)
git-svn-id: https://svn.apache.org/repos/asf/httpcomponents/httpclient/trunk@1423806 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
d72e9b3ae7
commit
877970d7d8
|
@ -44,6 +44,7 @@ import org.apache.http.client.cache.ResourceFactory;
|
|||
import org.apache.http.impl.cookie.DateParseException;
|
||||
import org.apache.http.impl.cookie.DateUtils;
|
||||
import org.apache.http.protocol.HTTP;
|
||||
import org.apache.http.util.Args;
|
||||
|
||||
/**
|
||||
* Update a {@link HttpCacheEntry} with new or updated information based on the latest
|
||||
|
@ -84,8 +85,8 @@ class CacheEntryUpdater {
|
|||
Date requestDate,
|
||||
Date responseDate,
|
||||
HttpResponse response) throws IOException {
|
||||
if (response.getStatusLine().getStatusCode() != HttpStatus.SC_NOT_MODIFIED)
|
||||
throw new IllegalArgumentException("Response must have 304 status code");
|
||||
Args.check(response.getStatusLine().getStatusCode() == HttpStatus.SC_NOT_MODIFIED,
|
||||
"Response must have 304 status code");
|
||||
Header[] mergedHeaders = mergeHeaders(entry, response);
|
||||
Resource oldResource = entry.getResource();
|
||||
Resource resource = null;
|
||||
|
|
|
@ -32,6 +32,7 @@ import java.lang.ref.ReferenceQueue;
|
|||
import org.apache.http.annotation.Immutable;
|
||||
import org.apache.http.client.cache.HttpCacheEntry;
|
||||
import org.apache.http.client.cache.Resource;
|
||||
import org.apache.http.util.Args;
|
||||
|
||||
@Immutable
|
||||
class ResourceReference extends PhantomReference<HttpCacheEntry> {
|
||||
|
@ -40,9 +41,7 @@ class ResourceReference extends PhantomReference<HttpCacheEntry> {
|
|||
|
||||
public ResourceReference(final HttpCacheEntry entry, final ReferenceQueue<HttpCacheEntry> q) {
|
||||
super(entry, q);
|
||||
if (entry.getResource() == null) {
|
||||
throw new IllegalArgumentException("Resource may not be null");
|
||||
}
|
||||
Args.notNull(entry.getResource(), "Resource");
|
||||
this.resource = entry.getResource();
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue