hc-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From j...@apache.org
Subject svn commit: r1232933 - in /httpcomponents/httpclient/branches/4.1.x: RELEASE_NOTES.txt httpclient-cache/src/main/java/org/apache/http/impl/client/cache/memcached/MemcachedHttpCacheStorage.java
Date Wed, 18 Jan 2012 15:35:25 GMT
Author: jonm
Date: Wed Jan 18 15:35:25 2012
New Revision: 1232933

URL: http://svn.apache.org/viewvc?rev=1232933&view=rev
Log:
HTTPCLIENT-1153: Stopgap bugfix for 4.1.x for storage keys that are longer
than memcached's maximum key length: catch the IllegalArgumentException that
results and then simply don't cache these urls. Not optimal, but restores
correct behavior. A more thorough fix is available in the 4.2.x release train.

Modified:
    httpcomponents/httpclient/branches/4.1.x/RELEASE_NOTES.txt
    httpcomponents/httpclient/branches/4.1.x/httpclient-cache/src/main/java/org/apache/http/impl/client/cache/memcached/MemcachedHttpCacheStorage.java

Modified: httpcomponents/httpclient/branches/4.1.x/RELEASE_NOTES.txt
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/branches/4.1.x/RELEASE_NOTES.txt?rev=1232933&r1=1232932&r2=1232933&view=diff
==============================================================================
--- httpcomponents/httpclient/branches/4.1.x/RELEASE_NOTES.txt (original)
+++ httpcomponents/httpclient/branches/4.1.x/RELEASE_NOTES.txt Wed Jan 18 15:35:25 2012
@@ -1,6 +1,12 @@
 Changes since 4.1.2
 -------------------
-* [HTTPCLIENT-1157] MemcachedHttpCacheStroage should throw IOExceptions
+* [HTTPCLIENT-1153] MemcachedHttpCacheStorage uses URL as cache key but
+  shouldn't; may exceed max memcached key length. Note that this bugfix
+  restores correct behavior by simply not caching these urls. A more
+  thorough fix to actually cache these will be available in version 4.2. 
+  Contributed by Jon Moore <jonm at apache dot org>.
+  
+* [HTTPCLIENT-1157] MemcachedHttpCacheStorage should throw IOExceptions
   instead of RuntimeExceptions.
   Contributed by James Miller <jamesmiller01 at gmail dot com>.
   

Modified: httpcomponents/httpclient/branches/4.1.x/httpclient-cache/src/main/java/org/apache/http/impl/client/cache/memcached/MemcachedHttpCacheStorage.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/branches/4.1.x/httpclient-cache/src/main/java/org/apache/http/impl/client/cache/memcached/MemcachedHttpCacheStorage.java?rev=1232933&r1=1232932&r2=1232933&view=diff
==============================================================================
--- httpcomponents/httpclient/branches/4.1.x/httpclient-cache/src/main/java/org/apache/http/impl/client/cache/memcached/MemcachedHttpCacheStorage.java
(original)
+++ httpcomponents/httpclient/branches/4.1.x/httpclient-cache/src/main/java/org/apache/http/impl/client/cache/memcached/MemcachedHttpCacheStorage.java
Wed Jan 18 15:35:25 2012
@@ -129,6 +129,9 @@ public class MemcachedHttpCacheStorage i
             client.set(url, 0, bos.toByteArray());
         } catch (OperationTimeoutException ex) {
             throw new MemcachedOperationTimeoutException(ex);
+        } catch (IllegalArgumentException iae) {
+            // url exceeds max key length for memcached
+            return;
         }
     }
 
@@ -153,6 +156,9 @@ public class MemcachedHttpCacheStorage i
             return reconstituteEntry(client.get(url));
         } catch (OperationTimeoutException ex) {
             throw new MemcachedOperationTimeoutException(ex);
+        } catch (IllegalArgumentException iae) {
+            // url exceeds max key length for memcached
+            return null;
         }
     }
 
@@ -161,6 +167,9 @@ public class MemcachedHttpCacheStorage i
             client.delete(url);
         } catch (OperationTimeoutException ex) {
             throw new MemcachedOperationTimeoutException(ex);
+        } catch (IllegalArgumentException iae) {
+            // url exceeds max key length for memcached
+            return;
         }
     }
 
@@ -189,6 +198,8 @@ public class MemcachedHttpCacheStorage i
                 }
             } catch (OperationTimeoutException ex) {
                 throw new MemcachedOperationTimeoutException(ex);
+            } catch (IllegalArgumentException iae) {
+                throw new HttpCacheUpdateException("url exceeds max key length for memcached");
             }
         } while (numRetries <= maxUpdateRetries);
 



Mime
View raw message