hc-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ol...@apache.org
Subject svn commit: r1239536 - in /httpcomponents/httpclient/trunk/httpclient-cache/src/main/java/org/apache/http: client/cache/ impl/client/cache/
Date Thu, 02 Feb 2012 11:12:12 GMT
Author: olegk
Date: Thu Feb  2 11:12:11 2012
New Revision: 1239536

URL: http://svn.apache.org/viewvc?rev=1239536&view=rev
Log:
HTTPCLIENT-1147: backed out API breaking changes

Modified:
    httpcomponents/httpclient/trunk/httpclient-cache/src/main/java/org/apache/http/client/cache/Resource.java
    httpcomponents/httpclient/trunk/httpclient-cache/src/main/java/org/apache/http/impl/client/cache/CacheValidityPolicy.java
    httpcomponents/httpclient/trunk/httpclient-cache/src/main/java/org/apache/http/impl/client/cache/CachedResponseSuitabilityChecker.java
    httpcomponents/httpclient/trunk/httpclient-cache/src/main/java/org/apache/http/impl/client/cache/FileResource.java
    httpcomponents/httpclient/trunk/httpclient-cache/src/main/java/org/apache/http/impl/client/cache/HeapResource.java

Modified: httpcomponents/httpclient/trunk/httpclient-cache/src/main/java/org/apache/http/client/cache/Resource.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient-cache/src/main/java/org/apache/http/client/cache/Resource.java?rev=1239536&r1=1239535&r2=1239536&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/httpclient-cache/src/main/java/org/apache/http/client/cache/Resource.java
(original)
+++ httpcomponents/httpclient/trunk/httpclient-cache/src/main/java/org/apache/http/client/cache/Resource.java
Thu Feb  2 11:12:11 2012
@@ -57,9 +57,4 @@ public interface Resource extends Serial
      */
     void dispose();
 
-    /**
-     * Is this resource still valid to be used
-     */
-    boolean isValid();
-
 }

Modified: httpcomponents/httpclient/trunk/httpclient-cache/src/main/java/org/apache/http/impl/client/cache/CacheValidityPolicy.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient-cache/src/main/java/org/apache/http/impl/client/cache/CacheValidityPolicy.java?rev=1239536&r1=1239535&r2=1239536&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/httpclient-cache/src/main/java/org/apache/http/impl/client/cache/CacheValidityPolicy.java
(original)
+++ httpcomponents/httpclient/trunk/httpclient-cache/src/main/java/org/apache/http/impl/client/cache/CacheValidityPolicy.java
Thu Feb  2 11:12:11 2012
@@ -108,10 +108,7 @@ class CacheValidityPolicy {
     }
 
     public boolean isRevalidatable(final HttpCacheEntry entry) {
-        if (!entry.getResource().isValid())
-            return false;
-        else
-            return entry.getFirstHeader(HeaderConstants.ETAG) != null
+        return entry.getFirstHeader(HeaderConstants.ETAG) != null
                 || entry.getFirstHeader(HeaderConstants.LAST_MODIFIED) != null;
     }
 

Modified: httpcomponents/httpclient/trunk/httpclient-cache/src/main/java/org/apache/http/impl/client/cache/CachedResponseSuitabilityChecker.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient-cache/src/main/java/org/apache/http/impl/client/cache/CachedResponseSuitabilityChecker.java?rev=1239536&r1=1239535&r2=1239536&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/httpclient-cache/src/main/java/org/apache/http/impl/client/cache/CachedResponseSuitabilityChecker.java
(original)
+++ httpcomponents/httpclient/trunk/httpclient-cache/src/main/java/org/apache/http/impl/client/cache/CachedResponseSuitabilityChecker.java
Thu Feb  2 11:12:11 2012
@@ -130,9 +130,6 @@ class CachedResponseSuitabilityChecker {
      * @return boolean yes/no answer
      */
     public boolean canCachedResponseBeUsed(HttpHost host, HttpRequest request, HttpCacheEntry
entry, Date now) {
-        if (!entry.getResource().isValid())  {
-            return false;
-        }
 
         if (!isFreshEnough(entry, request, now)) {
             log.trace("Cache entry was not fresh enough");

Modified: httpcomponents/httpclient/trunk/httpclient-cache/src/main/java/org/apache/http/impl/client/cache/FileResource.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient-cache/src/main/java/org/apache/http/impl/client/cache/FileResource.java?rev=1239536&r1=1239535&r2=1239536&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/httpclient-cache/src/main/java/org/apache/http/impl/client/cache/FileResource.java
(original)
+++ httpcomponents/httpclient/trunk/httpclient-cache/src/main/java/org/apache/http/impl/client/cache/FileResource.java
Thu Feb  2 11:12:11 2012
@@ -31,8 +31,6 @@ import java.io.FileInputStream;
 import java.io.IOException;
 import java.io.InputStream;
 
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
 import org.apache.http.annotation.ThreadSafe;
 import org.apache.http.client.cache.Resource;
 
@@ -50,34 +48,21 @@ public class FileResource implements Res
 
     private volatile boolean disposed;
 
-    private final Log log = LogFactory.getLog(getClass());
-
     public FileResource(final File file) {
         super();
         this.file = file;
         this.disposed = false;
     }
 
-    public boolean isValid() {
-        if (this.disposed || !file.exists()) {
-            log.warn("Resource has been deallocated");
-            return false;
-        }
-        return true;
-    }
-
     synchronized File getFile() {
-        isValid();
         return this.file;
     }
 
     public synchronized InputStream getInputStream() throws IOException {
-        isValid();
         return new FileInputStream(this.file);
     }
 
     public synchronized long length() {
-        isValid();
         return this.file.length();
     }
 

Modified: httpcomponents/httpclient/trunk/httpclient-cache/src/main/java/org/apache/http/impl/client/cache/HeapResource.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient-cache/src/main/java/org/apache/http/impl/client/cache/HeapResource.java?rev=1239536&r1=1239535&r2=1239536&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/httpclient-cache/src/main/java/org/apache/http/impl/client/cache/HeapResource.java
(original)
+++ httpcomponents/httpclient/trunk/httpclient-cache/src/main/java/org/apache/http/impl/client/cache/HeapResource.java
Thu Feb  2 11:12:11 2012
@@ -64,8 +64,4 @@ public class HeapResource implements Res
     public void dispose() {
     }
 
-    public boolean isValid() {
-        return true;
-    }
-
 }



Mime
View raw message