You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@hc.apache.org by "Clinton Nielsen (Created) (JIRA)" <ji...@apache.org> on 2011/12/20 20:28:31 UTC

[jira] [Created] (HTTPCLIENT-1152) org.apache.http.impl.client.cache.memcached.MemcachedHttpCacheStorage should verify class of returned object before casting

org.apache.http.impl.client.cache.memcached.MemcachedHttpCacheStorage should verify class of returned object before casting
---------------------------------------------------------------------------------------------------------------------------

                 Key: HTTPCLIENT-1152
                 URL: https://issues.apache.org/jira/browse/HTTPCLIENT-1152
             Project: HttpComponents HttpClient
          Issue Type: Bug
          Components: Cache, HttpClient
    Affects Versions: 4.1.1
            Reporter: Clinton Nielsen


org.apache.http.impl.client.cache.memcached.MemcachedHttpCacheStorage

Original (in getEntry function): 
  byte[] data = (byte[]) client.get(url);

Should be:
  Object obj= client.get(url);
  if (null == obj || !(objinstanceof byte[])) {
    return null;
  }
  byte[] data = (byte[])obj;


Original (in updateEntry function):
  byte[] oldBytes = (v != null) ? (byte[]) v.getValue() : null;

Should be:
  byte[] oldBytes = (v != null && (v.getValue() instanceof byte[])) ? (byte[]) v.getValue() : null;



  


--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org


[jira] [Commented] (HTTPCLIENT-1152) org.apache.http.impl.client.cache.memcached.MemcachedHttpCacheStorage should verify class of returned object before casting

Posted by "Clinton Nielsen (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HTTPCLIENT-1152?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13182540#comment-13182540 ] 

Clinton Nielsen commented on HTTPCLIENT-1152:
---------------------------------------------

Checked the diff. It looks like the issue is only half-fixed.
The fix has been applied to the updateEntry function, but not to the getEntry function.

Thanks.
                
> org.apache.http.impl.client.cache.memcached.MemcachedHttpCacheStorage should verify class of returned object before casting
> ---------------------------------------------------------------------------------------------------------------------------
>
>                 Key: HTTPCLIENT-1152
>                 URL: https://issues.apache.org/jira/browse/HTTPCLIENT-1152
>             Project: HttpComponents HttpClient
>          Issue Type: Bug
>          Components: Cache, HttpClient
>    Affects Versions: 4.1.1
>            Reporter: Clinton Nielsen
>            Assignee: Jon Moore
>            Priority: Minor
>             Fix For: 4.1.3, 4.2 Alpha2
>
>         Attachments: HTTPCLIENT-1152.patch
>
>
> org.apache.http.impl.client.cache.memcached.MemcachedHttpCacheStorage
> Original (in getEntry function): 
>   byte[] data = (byte[]) client.get(url);
> Should be:
>   Object obj= client.get(url);
>   if (null == obj || !(objinstanceof byte[])) {
>     return null;
>   }
>   byte[] data = (byte[])obj;
> Original (in updateEntry function):
>   byte[] oldBytes = (v != null) ? (byte[]) v.getValue() : null;
> Should be:
>   byte[] oldBytes = (v != null && (v.getValue() instanceof byte[])) ? (byte[]) v.getValue() : null;
>   

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org


[jira] [Commented] (HTTPCLIENT-1152) org.apache.http.impl.client.cache.memcached.MemcachedHttpCacheStorage should verify class of returned object before casting

Posted by "Jon Moore (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HTTPCLIENT-1152?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13174309#comment-13174309 ] 

Jon Moore commented on HTTPCLIENT-1152:
---------------------------------------

@Clinton: I've been thinking about adding an optional string-prefix configuration option to the memcached storage as well; would you mind opening that as a separate improvement request?

                
> org.apache.http.impl.client.cache.memcached.MemcachedHttpCacheStorage should verify class of returned object before casting
> ---------------------------------------------------------------------------------------------------------------------------
>
>                 Key: HTTPCLIENT-1152
>                 URL: https://issues.apache.org/jira/browse/HTTPCLIENT-1152
>             Project: HttpComponents HttpClient
>          Issue Type: Bug
>          Components: Cache, HttpClient
>    Affects Versions: 4.1.1
>            Reporter: Clinton Nielsen
>            Assignee: Jon Moore
>         Attachments: HTTPCLIENT-1152.patch
>
>
> org.apache.http.impl.client.cache.memcached.MemcachedHttpCacheStorage
> Original (in getEntry function): 
>   byte[] data = (byte[]) client.get(url);
> Should be:
>   Object obj= client.get(url);
>   if (null == obj || !(objinstanceof byte[])) {
>     return null;
>   }
>   byte[] data = (byte[])obj;
> Original (in updateEntry function):
>   byte[] oldBytes = (v != null) ? (byte[]) v.getValue() : null;
> Should be:
>   byte[] oldBytes = (v != null && (v.getValue() instanceof byte[])) ? (byte[]) v.getValue() : null;
>   

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org


[jira] [Closed] (HTTPCLIENT-1152) org.apache.http.impl.client.cache.memcached.MemcachedHttpCacheStorage should verify class of returned object before casting

Posted by "Clinton Nielsen (Closed) (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/HTTPCLIENT-1152?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Clinton Nielsen closed HTTPCLIENT-1152.
---------------------------------------


Verified as fixed in trunk.
                
> org.apache.http.impl.client.cache.memcached.MemcachedHttpCacheStorage should verify class of returned object before casting
> ---------------------------------------------------------------------------------------------------------------------------
>
>                 Key: HTTPCLIENT-1152
>                 URL: https://issues.apache.org/jira/browse/HTTPCLIENT-1152
>             Project: HttpComponents HttpClient
>          Issue Type: Bug
>          Components: Cache, HttpClient
>    Affects Versions: 4.1.1
>            Reporter: Clinton Nielsen
>            Assignee: Jon Moore
>            Priority: Minor
>             Fix For: 4.1.3, 4.2 Alpha2
>
>         Attachments: HTTPCLIENT-1152.patch
>
>
> org.apache.http.impl.client.cache.memcached.MemcachedHttpCacheStorage
> Original (in getEntry function): 
>   byte[] data = (byte[]) client.get(url);
> Should be:
>   Object obj= client.get(url);
>   if (null == obj || !(objinstanceof byte[])) {
>     return null;
>   }
>   byte[] data = (byte[])obj;
> Original (in updateEntry function):
>   byte[] oldBytes = (v != null) ? (byte[]) v.getValue() : null;
> Should be:
>   byte[] oldBytes = (v != null && (v.getValue() instanceof byte[])) ? (byte[]) v.getValue() : null;
>   

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org


[jira] [Assigned] (HTTPCLIENT-1152) org.apache.http.impl.client.cache.memcached.MemcachedHttpCacheStorage should verify class of returned object before casting

Posted by "Jon Moore (Assigned) (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/HTTPCLIENT-1152?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Jon Moore reassigned HTTPCLIENT-1152:
-------------------------------------

    Assignee: Jon Moore
    
> org.apache.http.impl.client.cache.memcached.MemcachedHttpCacheStorage should verify class of returned object before casting
> ---------------------------------------------------------------------------------------------------------------------------
>
>                 Key: HTTPCLIENT-1152
>                 URL: https://issues.apache.org/jira/browse/HTTPCLIENT-1152
>             Project: HttpComponents HttpClient
>          Issue Type: Bug
>          Components: Cache, HttpClient
>    Affects Versions: 4.1.1
>            Reporter: Clinton Nielsen
>            Assignee: Jon Moore
>             Fix For: 4.1.3, 4.2 Final
>
>
> org.apache.http.impl.client.cache.memcached.MemcachedHttpCacheStorage
> Original (in getEntry function): 
>   byte[] data = (byte[]) client.get(url);
> Should be:
>   Object obj= client.get(url);
>   if (null == obj || !(objinstanceof byte[])) {
>     return null;
>   }
>   byte[] data = (byte[])obj;
> Original (in updateEntry function):
>   byte[] oldBytes = (v != null) ? (byte[]) v.getValue() : null;
> Should be:
>   byte[] oldBytes = (v != null && (v.getValue() instanceof byte[])) ? (byte[]) v.getValue() : null;
>   

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org


[jira] [Issue Comment Edited] (HTTPCLIENT-1152) org.apache.http.impl.client.cache.memcached.MemcachedHttpCacheStorage should verify class of returned object before casting

Posted by "Clinton Nielsen (Issue Comment Edited) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HTTPCLIENT-1152?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13174304#comment-13174304 ] 

Clinton Nielsen edited comment on HTTPCLIENT-1152 at 12/21/11 7:04 PM:
-----------------------------------------------------------------------

>> In my case, it is that we are using jmemcacheddaemon for local testing purposes, and (unfortunately) jmemcacheddaemon has 
>> a known bug where cache misses return an empty string instead of a null object. 

>OK. But I do not think that polluting a general purpose library with a hack clearly specific to your local environment is the right thing to do. Simply implement a custom HttpCacheStorage which is aware of the empty string semantics. 

Fair enough. But as a general principle, if memcached ever retrieves an object that isn't the expected type, it should count as a cache-miss. It certainly shouldn't throw a ClassCastException. Just 'miss' and move on.


--- I actually had already extended MemcachedHttpCacheStorage to make it aware of the empty-string problem, and also to hash URLs using SHA-512, and to allow a custom prefix on the keys. So I'm good. I just opened these bugs so you could be aware and make changes if you want.  :)
                
      was (Author: tinclon):
    >> In my case, it is that we are using jmemcacheddaemon for local testing purposes, and (unfortunately) jmemcacheddaemon has 
>> a known bug where cache misses return an empty string instead of a null object. 

>OK. But I do not think that polluting a general purpose library with a hack clearly specific to your local environment is the right thing to do. Simply implement a custom HttpCacheStorage which is aware of the empty string semantics. 

Fair enough. But as a general principle, if memcached ever retrieves an object that isn't the expected type, it should count as a cache-miss. It certainly shouldn't throw a ClassCastException. Just 'miss' and move on.
                  
> org.apache.http.impl.client.cache.memcached.MemcachedHttpCacheStorage should verify class of returned object before casting
> ---------------------------------------------------------------------------------------------------------------------------
>
>                 Key: HTTPCLIENT-1152
>                 URL: https://issues.apache.org/jira/browse/HTTPCLIENT-1152
>             Project: HttpComponents HttpClient
>          Issue Type: Bug
>          Components: Cache, HttpClient
>    Affects Versions: 4.1.1
>            Reporter: Clinton Nielsen
>            Assignee: Jon Moore
>         Attachments: HTTPCLIENT-1152.patch
>
>
> org.apache.http.impl.client.cache.memcached.MemcachedHttpCacheStorage
> Original (in getEntry function): 
>   byte[] data = (byte[]) client.get(url);
> Should be:
>   Object obj= client.get(url);
>   if (null == obj || !(objinstanceof byte[])) {
>     return null;
>   }
>   byte[] data = (byte[])obj;
> Original (in updateEntry function):
>   byte[] oldBytes = (v != null) ? (byte[]) v.getValue() : null;
> Should be:
>   byte[] oldBytes = (v != null && (v.getValue() instanceof byte[])) ? (byte[]) v.getValue() : null;
>   

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org


[jira] [Commented] (HTTPCLIENT-1152) org.apache.http.impl.client.cache.memcached.MemcachedHttpCacheStorage should verify class of returned object before casting

Posted by "Oleg Kalnichevski (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HTTPCLIENT-1152?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13174195#comment-13174195 ] 

Oleg Kalnichevski commented on HTTPCLIENT-1152:
-----------------------------------------------

One thing I do not quite understand. Why would there be anything other than byte array in the memcache? In case someone was silly enough to have stuck some arbitrary object in the memcache used by HttpClientCache throwing ClassCastException seems perfectly reasonable.

Oleg
                
> org.apache.http.impl.client.cache.memcached.MemcachedHttpCacheStorage should verify class of returned object before casting
> ---------------------------------------------------------------------------------------------------------------------------
>
>                 Key: HTTPCLIENT-1152
>                 URL: https://issues.apache.org/jira/browse/HTTPCLIENT-1152
>             Project: HttpComponents HttpClient
>          Issue Type: Bug
>          Components: Cache, HttpClient
>    Affects Versions: 4.1.1
>            Reporter: Clinton Nielsen
>            Assignee: Jon Moore
>             Fix For: 4.1.3, 4.2 Final
>
>         Attachments: HTTPCLIENT-1152.patch
>
>
> org.apache.http.impl.client.cache.memcached.MemcachedHttpCacheStorage
> Original (in getEntry function): 
>   byte[] data = (byte[]) client.get(url);
> Should be:
>   Object obj= client.get(url);
>   if (null == obj || !(objinstanceof byte[])) {
>     return null;
>   }
>   byte[] data = (byte[])obj;
> Original (in updateEntry function):
>   byte[] oldBytes = (v != null) ? (byte[]) v.getValue() : null;
> Should be:
>   byte[] oldBytes = (v != null && (v.getValue() instanceof byte[])) ? (byte[]) v.getValue() : null;
>   

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org


[jira] [Resolved] (HTTPCLIENT-1152) org.apache.http.impl.client.cache.memcached.MemcachedHttpCacheStorage should verify class of returned object before casting

Posted by "Jon Moore (Resolved) (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/HTTPCLIENT-1152?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Jon Moore resolved HTTPCLIENT-1152.
-----------------------------------

    Resolution: Fixed

Checked into trunk and backported to 4.1.x.

@Clinton - can you review and close this issue if you're satisfied?

                
> org.apache.http.impl.client.cache.memcached.MemcachedHttpCacheStorage should verify class of returned object before casting
> ---------------------------------------------------------------------------------------------------------------------------
>
>                 Key: HTTPCLIENT-1152
>                 URL: https://issues.apache.org/jira/browse/HTTPCLIENT-1152
>             Project: HttpComponents HttpClient
>          Issue Type: Bug
>          Components: Cache, HttpClient
>    Affects Versions: 4.1.1
>            Reporter: Clinton Nielsen
>            Assignee: Jon Moore
>            Priority: Minor
>             Fix For: 4.1.3, 4.2 Alpha2
>
>         Attachments: HTTPCLIENT-1152.patch
>
>
> org.apache.http.impl.client.cache.memcached.MemcachedHttpCacheStorage
> Original (in getEntry function): 
>   byte[] data = (byte[]) client.get(url);
> Should be:
>   Object obj= client.get(url);
>   if (null == obj || !(objinstanceof byte[])) {
>     return null;
>   }
>   byte[] data = (byte[])obj;
> Original (in updateEntry function):
>   byte[] oldBytes = (v != null) ? (byte[]) v.getValue() : null;
> Should be:
>   byte[] oldBytes = (v != null && (v.getValue() instanceof byte[])) ? (byte[]) v.getValue() : null;
>   

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org


[jira] [Commented] (HTTPCLIENT-1152) org.apache.http.impl.client.cache.memcached.MemcachedHttpCacheStorage should verify class of returned object before casting

Posted by "Clinton Nielsen (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HTTPCLIENT-1152?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13174321#comment-13174321 ] 

Clinton Nielsen commented on HTTPCLIENT-1152:
---------------------------------------------

Yup, I'll do that right away.
                
> org.apache.http.impl.client.cache.memcached.MemcachedHttpCacheStorage should verify class of returned object before casting
> ---------------------------------------------------------------------------------------------------------------------------
>
>                 Key: HTTPCLIENT-1152
>                 URL: https://issues.apache.org/jira/browse/HTTPCLIENT-1152
>             Project: HttpComponents HttpClient
>          Issue Type: Bug
>          Components: Cache, HttpClient
>    Affects Versions: 4.1.1
>            Reporter: Clinton Nielsen
>            Assignee: Jon Moore
>         Attachments: HTTPCLIENT-1152.patch
>
>
> org.apache.http.impl.client.cache.memcached.MemcachedHttpCacheStorage
> Original (in getEntry function): 
>   byte[] data = (byte[]) client.get(url);
> Should be:
>   Object obj= client.get(url);
>   if (null == obj || !(objinstanceof byte[])) {
>     return null;
>   }
>   byte[] data = (byte[])obj;
> Original (in updateEntry function):
>   byte[] oldBytes = (v != null) ? (byte[]) v.getValue() : null;
> Should be:
>   byte[] oldBytes = (v != null && (v.getValue() instanceof byte[])) ? (byte[]) v.getValue() : null;
>   

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org


[jira] [Reopened] (HTTPCLIENT-1152) org.apache.http.impl.client.cache.memcached.MemcachedHttpCacheStorage should verify class of returned object before casting

Posted by "Jon Moore (Reopened) (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/HTTPCLIENT-1152?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Jon Moore reopened HTTPCLIENT-1152:
-----------------------------------


I'm actually going to reopen this, as I think it's a pretty small change that adds to the robustness of the library (and I'll work on integrating and committing it). Upon encountering something weird coming back out of memcached, I think logging a warning and then acting as if it were a cache miss is good and prudent behavior.

                
> org.apache.http.impl.client.cache.memcached.MemcachedHttpCacheStorage should verify class of returned object before casting
> ---------------------------------------------------------------------------------------------------------------------------
>
>                 Key: HTTPCLIENT-1152
>                 URL: https://issues.apache.org/jira/browse/HTTPCLIENT-1152
>             Project: HttpComponents HttpClient
>          Issue Type: Bug
>          Components: Cache, HttpClient
>    Affects Versions: 4.1.1
>            Reporter: Clinton Nielsen
>            Assignee: Jon Moore
>         Attachments: HTTPCLIENT-1152.patch
>
>
> org.apache.http.impl.client.cache.memcached.MemcachedHttpCacheStorage
> Original (in getEntry function): 
>   byte[] data = (byte[]) client.get(url);
> Should be:
>   Object obj= client.get(url);
>   if (null == obj || !(objinstanceof byte[])) {
>     return null;
>   }
>   byte[] data = (byte[])obj;
> Original (in updateEntry function):
>   byte[] oldBytes = (v != null) ? (byte[]) v.getValue() : null;
> Should be:
>   byte[] oldBytes = (v != null && (v.getValue() instanceof byte[])) ? (byte[]) v.getValue() : null;
>   

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org


[jira] [Commented] (HTTPCLIENT-1152) org.apache.http.impl.client.cache.memcached.MemcachedHttpCacheStorage should verify class of returned object before casting

Posted by "Clinton Nielsen (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HTTPCLIENT-1152?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13174204#comment-13174204 ] 

Clinton Nielsen commented on HTTPCLIENT-1152:
---------------------------------------------

Could be that somebody is using the cache for other purposes as well, and just happens to set an object with a URL as a key that conflicts with an object that is set by MemcachedHttpCacheStorage.
 -- this could (and also probably should) be mitigated by allowing the client of MemcachedHttpCacheStorage to set a client-defined prefix String that will be prefixed to all keys, thus avoiding potential collisions.


In my case, it is that we are using jmemcacheddaemon for local testing purposes, and (unfortunately) jmemcacheddaemon has a known bug where cache misses return an empty string instead of a null object. This causes MemcachedHttpCacheStorage to throw a ClassCastException instead of just returning null, because String cannot be cast to byte[].
                
> org.apache.http.impl.client.cache.memcached.MemcachedHttpCacheStorage should verify class of returned object before casting
> ---------------------------------------------------------------------------------------------------------------------------
>
>                 Key: HTTPCLIENT-1152
>                 URL: https://issues.apache.org/jira/browse/HTTPCLIENT-1152
>             Project: HttpComponents HttpClient
>          Issue Type: Bug
>          Components: Cache, HttpClient
>    Affects Versions: 4.1.1
>            Reporter: Clinton Nielsen
>            Assignee: Jon Moore
>             Fix For: 4.1.3, 4.2 Final
>
>         Attachments: HTTPCLIENT-1152.patch
>
>
> org.apache.http.impl.client.cache.memcached.MemcachedHttpCacheStorage
> Original (in getEntry function): 
>   byte[] data = (byte[]) client.get(url);
> Should be:
>   Object obj= client.get(url);
>   if (null == obj || !(objinstanceof byte[])) {
>     return null;
>   }
>   byte[] data = (byte[])obj;
> Original (in updateEntry function):
>   byte[] oldBytes = (v != null) ? (byte[]) v.getValue() : null;
> Should be:
>   byte[] oldBytes = (v != null && (v.getValue() instanceof byte[])) ? (byte[]) v.getValue() : null;
>   

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org


[jira] [Commented] (HTTPCLIENT-1152) org.apache.http.impl.client.cache.memcached.MemcachedHttpCacheStorage should verify class of returned object before casting

Posted by "Jon Moore (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HTTPCLIENT-1152?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13182555#comment-13182555 ] 

Jon Moore commented on HTTPCLIENT-1152:
---------------------------------------

@Clinton - added the same checking to the getEntry() side and refactored the commonality out. This is checked into trunk now.

                
> org.apache.http.impl.client.cache.memcached.MemcachedHttpCacheStorage should verify class of returned object before casting
> ---------------------------------------------------------------------------------------------------------------------------
>
>                 Key: HTTPCLIENT-1152
>                 URL: https://issues.apache.org/jira/browse/HTTPCLIENT-1152
>             Project: HttpComponents HttpClient
>          Issue Type: Bug
>          Components: Cache, HttpClient
>    Affects Versions: 4.1.1
>            Reporter: Clinton Nielsen
>            Assignee: Jon Moore
>            Priority: Minor
>             Fix For: 4.1.3, 4.2 Alpha2
>
>         Attachments: HTTPCLIENT-1152.patch
>
>
> org.apache.http.impl.client.cache.memcached.MemcachedHttpCacheStorage
> Original (in getEntry function): 
>   byte[] data = (byte[]) client.get(url);
> Should be:
>   Object obj= client.get(url);
>   if (null == obj || !(objinstanceof byte[])) {
>     return null;
>   }
>   byte[] data = (byte[])obj;
> Original (in updateEntry function):
>   byte[] oldBytes = (v != null) ? (byte[]) v.getValue() : null;
> Should be:
>   byte[] oldBytes = (v != null && (v.getValue() instanceof byte[])) ? (byte[]) v.getValue() : null;
>   

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org


[jira] [Commented] (HTTPCLIENT-1152) org.apache.http.impl.client.cache.memcached.MemcachedHttpCacheStorage should verify class of returned object before casting

Posted by "Clinton Nielsen (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HTTPCLIENT-1152?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13174304#comment-13174304 ] 

Clinton Nielsen commented on HTTPCLIENT-1152:
---------------------------------------------

>> In my case, it is that we are using jmemcacheddaemon for local testing purposes, and (unfortunately) jmemcacheddaemon has 
>> a known bug where cache misses return an empty string instead of a null object. 

>OK. But I do not think that polluting a general purpose library with a hack clearly specific to your local environment is the right thing to do. Simply implement a custom HttpCacheStorage which is aware of the empty string semantics. 

Fair enough. But as a general principle, if memcached ever retrieves an object that isn't the expected type, it should count as a cache-miss. It certainly shouldn't throw a ClassCastException. Just 'miss' and move on.
                
> org.apache.http.impl.client.cache.memcached.MemcachedHttpCacheStorage should verify class of returned object before casting
> ---------------------------------------------------------------------------------------------------------------------------
>
>                 Key: HTTPCLIENT-1152
>                 URL: https://issues.apache.org/jira/browse/HTTPCLIENT-1152
>             Project: HttpComponents HttpClient
>          Issue Type: Bug
>          Components: Cache, HttpClient
>    Affects Versions: 4.1.1
>            Reporter: Clinton Nielsen
>            Assignee: Jon Moore
>         Attachments: HTTPCLIENT-1152.patch
>
>
> org.apache.http.impl.client.cache.memcached.MemcachedHttpCacheStorage
> Original (in getEntry function): 
>   byte[] data = (byte[]) client.get(url);
> Should be:
>   Object obj= client.get(url);
>   if (null == obj || !(objinstanceof byte[])) {
>     return null;
>   }
>   byte[] data = (byte[])obj;
> Original (in updateEntry function):
>   byte[] oldBytes = (v != null) ? (byte[]) v.getValue() : null;
> Should be:
>   byte[] oldBytes = (v != null && (v.getValue() instanceof byte[])) ? (byte[]) v.getValue() : null;
>   

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org


[jira] [Commented] (HTTPCLIENT-1152) org.apache.http.impl.client.cache.memcached.MemcachedHttpCacheStorage should verify class of returned object before casting

Posted by "Clinton Nielsen (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HTTPCLIENT-1152?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13174122#comment-13174122 ] 

Clinton Nielsen commented on HTTPCLIENT-1152:
---------------------------------------------

Looks like the patch fixes the problems in updateEntry, but fails to fix the same problem in getEntry.
                
> org.apache.http.impl.client.cache.memcached.MemcachedHttpCacheStorage should verify class of returned object before casting
> ---------------------------------------------------------------------------------------------------------------------------
>
>                 Key: HTTPCLIENT-1152
>                 URL: https://issues.apache.org/jira/browse/HTTPCLIENT-1152
>             Project: HttpComponents HttpClient
>          Issue Type: Bug
>          Components: Cache, HttpClient
>    Affects Versions: 4.1.1
>            Reporter: Clinton Nielsen
>            Assignee: Jon Moore
>             Fix For: 4.1.3, 4.2 Final
>
>         Attachments: HTTPCLIENT-1152.patch
>
>
> org.apache.http.impl.client.cache.memcached.MemcachedHttpCacheStorage
> Original (in getEntry function): 
>   byte[] data = (byte[]) client.get(url);
> Should be:
>   Object obj= client.get(url);
>   if (null == obj || !(objinstanceof byte[])) {
>     return null;
>   }
>   byte[] data = (byte[])obj;
> Original (in updateEntry function):
>   byte[] oldBytes = (v != null) ? (byte[]) v.getValue() : null;
> Should be:
>   byte[] oldBytes = (v != null && (v.getValue() instanceof byte[])) ? (byte[]) v.getValue() : null;
>   

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org


[jira] [Commented] (HTTPCLIENT-1152) org.apache.http.impl.client.cache.memcached.MemcachedHttpCacheStorage should verify class of returned object before casting

Posted by "Jon Moore (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HTTPCLIENT-1152?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13182546#comment-13182546 ] 

Jon Moore commented on HTTPCLIENT-1152:
---------------------------------------

@Clinton - good catch; will fix forthwith.
                
> org.apache.http.impl.client.cache.memcached.MemcachedHttpCacheStorage should verify class of returned object before casting
> ---------------------------------------------------------------------------------------------------------------------------
>
>                 Key: HTTPCLIENT-1152
>                 URL: https://issues.apache.org/jira/browse/HTTPCLIENT-1152
>             Project: HttpComponents HttpClient
>          Issue Type: Bug
>          Components: Cache, HttpClient
>    Affects Versions: 4.1.1
>            Reporter: Clinton Nielsen
>            Assignee: Jon Moore
>            Priority: Minor
>             Fix For: 4.1.3, 4.2 Alpha2
>
>         Attachments: HTTPCLIENT-1152.patch
>
>
> org.apache.http.impl.client.cache.memcached.MemcachedHttpCacheStorage
> Original (in getEntry function): 
>   byte[] data = (byte[]) client.get(url);
> Should be:
>   Object obj= client.get(url);
>   if (null == obj || !(objinstanceof byte[])) {
>     return null;
>   }
>   byte[] data = (byte[])obj;
> Original (in updateEntry function):
>   byte[] oldBytes = (v != null) ? (byte[]) v.getValue() : null;
> Should be:
>   byte[] oldBytes = (v != null && (v.getValue() instanceof byte[])) ? (byte[]) v.getValue() : null;
>   

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org


[jira] [Resolved] (HTTPCLIENT-1152) org.apache.http.impl.client.cache.memcached.MemcachedHttpCacheStorage should verify class of returned object before casting

Posted by "Oleg Kalnichevski (Resolved) (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/HTTPCLIENT-1152?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Oleg Kalnichevski resolved HTTPCLIENT-1152.
-------------------------------------------

       Resolution: Invalid
    Fix Version/s:     (was: 4.1.3)
                       (was: 4.2 Final)

> Could be that somebody is using the cache for other purposes as well, and just happens to set an object with a URL as a key that
> conflicts with an object that is set by MemcachedHttpCacheStorage

Could be that somebody is using computer to hammer nails. We can't stop people from doing silly stuff.

>  -- this could (and also probably should) be mitigated by allowing the client of MemcachedHttpCacheStorage to set a client-defined 
> prefix String that will be prefixed to all keys, thus avoiding potential collisions. 

This is actually a very reasonable suggestion. Probably what we need is a generic strategy that can be used to generate a unique cache key from a request url. This would also take care of HTTPCLIENT-1153.

> In my case, it is that we are using jmemcacheddaemon for local testing purposes, and (unfortunately) jmemcacheddaemon has 
> a known bug where cache misses return an empty string instead of a null object. 

OK. But I do not think that polluting a general purpose library with a hack clearly specific to your local environment is the right thing to do. Simply implement a custom HttpCacheStorage which is aware of the empty string semantics.

Oleg
                
> org.apache.http.impl.client.cache.memcached.MemcachedHttpCacheStorage should verify class of returned object before casting
> ---------------------------------------------------------------------------------------------------------------------------
>
>                 Key: HTTPCLIENT-1152
>                 URL: https://issues.apache.org/jira/browse/HTTPCLIENT-1152
>             Project: HttpComponents HttpClient
>          Issue Type: Bug
>          Components: Cache, HttpClient
>    Affects Versions: 4.1.1
>            Reporter: Clinton Nielsen
>            Assignee: Jon Moore
>         Attachments: HTTPCLIENT-1152.patch
>
>
> org.apache.http.impl.client.cache.memcached.MemcachedHttpCacheStorage
> Original (in getEntry function): 
>   byte[] data = (byte[]) client.get(url);
> Should be:
>   Object obj= client.get(url);
>   if (null == obj || !(objinstanceof byte[])) {
>     return null;
>   }
>   byte[] data = (byte[])obj;
> Original (in updateEntry function):
>   byte[] oldBytes = (v != null) ? (byte[]) v.getValue() : null;
> Should be:
>   byte[] oldBytes = (v != null && (v.getValue() instanceof byte[])) ? (byte[]) v.getValue() : null;
>   

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org


[jira] [Updated] (HTTPCLIENT-1152) org.apache.http.impl.client.cache.memcached.MemcachedHttpCacheStorage should verify class of returned object before casting

Posted by "Jon Moore (Updated) (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/HTTPCLIENT-1152?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Jon Moore updated HTTPCLIENT-1152:
----------------------------------

    Fix Version/s: 4.2 Final
                   4.1.3
    
> org.apache.http.impl.client.cache.memcached.MemcachedHttpCacheStorage should verify class of returned object before casting
> ---------------------------------------------------------------------------------------------------------------------------
>
>                 Key: HTTPCLIENT-1152
>                 URL: https://issues.apache.org/jira/browse/HTTPCLIENT-1152
>             Project: HttpComponents HttpClient
>          Issue Type: Bug
>          Components: Cache, HttpClient
>    Affects Versions: 4.1.1
>            Reporter: Clinton Nielsen
>            Assignee: Jon Moore
>             Fix For: 4.1.3, 4.2 Final
>
>
> org.apache.http.impl.client.cache.memcached.MemcachedHttpCacheStorage
> Original (in getEntry function): 
>   byte[] data = (byte[]) client.get(url);
> Should be:
>   Object obj= client.get(url);
>   if (null == obj || !(objinstanceof byte[])) {
>     return null;
>   }
>   byte[] data = (byte[])obj;
> Original (in updateEntry function):
>   byte[] oldBytes = (v != null) ? (byte[]) v.getValue() : null;
> Should be:
>   byte[] oldBytes = (v != null && (v.getValue() instanceof byte[])) ? (byte[]) v.getValue() : null;
>   

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org


[jira] [Commented] (HTTPCLIENT-1152) org.apache.http.impl.client.cache.memcached.MemcachedHttpCacheStorage should verify class of returned object before casting

Posted by "Jon Moore (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HTTPCLIENT-1152?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13182525#comment-13182525 ] 

Jon Moore commented on HTTPCLIENT-1152:
---------------------------------------

@Rajika: just checked your patch in, along with the addition of a WARN-level log message if we encounter memcached giving us something other than a byte[] back. Will work on porting this to the 4.1.x branch next.
                
> org.apache.http.impl.client.cache.memcached.MemcachedHttpCacheStorage should verify class of returned object before casting
> ---------------------------------------------------------------------------------------------------------------------------
>
>                 Key: HTTPCLIENT-1152
>                 URL: https://issues.apache.org/jira/browse/HTTPCLIENT-1152
>             Project: HttpComponents HttpClient
>          Issue Type: Bug
>          Components: Cache, HttpClient
>    Affects Versions: 4.1.1
>            Reporter: Clinton Nielsen
>            Assignee: Jon Moore
>            Priority: Minor
>             Fix For: 4.1.3, 4.2 Alpha2
>
>         Attachments: HTTPCLIENT-1152.patch
>
>
> org.apache.http.impl.client.cache.memcached.MemcachedHttpCacheStorage
> Original (in getEntry function): 
>   byte[] data = (byte[]) client.get(url);
> Should be:
>   Object obj= client.get(url);
>   if (null == obj || !(objinstanceof byte[])) {
>     return null;
>   }
>   byte[] data = (byte[])obj;
> Original (in updateEntry function):
>   byte[] oldBytes = (v != null) ? (byte[]) v.getValue() : null;
> Should be:
>   byte[] oldBytes = (v != null && (v.getValue() instanceof byte[])) ? (byte[]) v.getValue() : null;
>   

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org


[jira] [Updated] (HTTPCLIENT-1152) org.apache.http.impl.client.cache.memcached.MemcachedHttpCacheStorage should verify class of returned object before casting

Posted by "Rajika Kumarasiri (Updated) (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/HTTPCLIENT-1152?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Rajika Kumarasiri updated HTTPCLIENT-1152:
------------------------------------------

    Attachment: HTTPCLIENT-1152.patch

There is possibility of getting a Class Cast Exception.  Here is a patch for the issue. I also fixed some code indentation for more readability. 

Rajika
                
> org.apache.http.impl.client.cache.memcached.MemcachedHttpCacheStorage should verify class of returned object before casting
> ---------------------------------------------------------------------------------------------------------------------------
>
>                 Key: HTTPCLIENT-1152
>                 URL: https://issues.apache.org/jira/browse/HTTPCLIENT-1152
>             Project: HttpComponents HttpClient
>          Issue Type: Bug
>          Components: Cache, HttpClient
>    Affects Versions: 4.1.1
>            Reporter: Clinton Nielsen
>            Assignee: Jon Moore
>             Fix For: 4.1.3, 4.2 Final
>
>         Attachments: HTTPCLIENT-1152.patch
>
>
> org.apache.http.impl.client.cache.memcached.MemcachedHttpCacheStorage
> Original (in getEntry function): 
>   byte[] data = (byte[]) client.get(url);
> Should be:
>   Object obj= client.get(url);
>   if (null == obj || !(objinstanceof byte[])) {
>     return null;
>   }
>   byte[] data = (byte[])obj;
> Original (in updateEntry function):
>   byte[] oldBytes = (v != null) ? (byte[]) v.getValue() : null;
> Should be:
>   byte[] oldBytes = (v != null && (v.getValue() instanceof byte[])) ? (byte[]) v.getValue() : null;
>   

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org


[jira] [Updated] (HTTPCLIENT-1152) org.apache.http.impl.client.cache.memcached.MemcachedHttpCacheStorage should verify class of returned object before casting

Posted by "Jon Moore (Updated) (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/HTTPCLIENT-1152?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Jon Moore updated HTTPCLIENT-1152:
----------------------------------

         Priority: Minor  (was: Major)
    Fix Version/s: 4.2 Alpha2
                   4.1.3
    
> org.apache.http.impl.client.cache.memcached.MemcachedHttpCacheStorage should verify class of returned object before casting
> ---------------------------------------------------------------------------------------------------------------------------
>
>                 Key: HTTPCLIENT-1152
>                 URL: https://issues.apache.org/jira/browse/HTTPCLIENT-1152
>             Project: HttpComponents HttpClient
>          Issue Type: Bug
>          Components: Cache, HttpClient
>    Affects Versions: 4.1.1
>            Reporter: Clinton Nielsen
>            Assignee: Jon Moore
>            Priority: Minor
>             Fix For: 4.1.3, 4.2 Alpha2
>
>         Attachments: HTTPCLIENT-1152.patch
>
>
> org.apache.http.impl.client.cache.memcached.MemcachedHttpCacheStorage
> Original (in getEntry function): 
>   byte[] data = (byte[]) client.get(url);
> Should be:
>   Object obj= client.get(url);
>   if (null == obj || !(objinstanceof byte[])) {
>     return null;
>   }
>   byte[] data = (byte[])obj;
> Original (in updateEntry function):
>   byte[] oldBytes = (v != null) ? (byte[]) v.getValue() : null;
> Should be:
>   byte[] oldBytes = (v != null && (v.getValue() instanceof byte[])) ? (byte[]) v.getValue() : null;
>   

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org


[jira] [Commented] (HTTPCLIENT-1152) org.apache.http.impl.client.cache.memcached.MemcachedHttpCacheStorage should verify class of returned object before casting

Posted by "Jon Moore (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HTTPCLIENT-1152?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13182813#comment-13182813 ] 

Jon Moore commented on HTTPCLIENT-1152:
---------------------------------------

Ok, also backported to 4.1.x.
                
> org.apache.http.impl.client.cache.memcached.MemcachedHttpCacheStorage should verify class of returned object before casting
> ---------------------------------------------------------------------------------------------------------------------------
>
>                 Key: HTTPCLIENT-1152
>                 URL: https://issues.apache.org/jira/browse/HTTPCLIENT-1152
>             Project: HttpComponents HttpClient
>          Issue Type: Bug
>          Components: Cache, HttpClient
>    Affects Versions: 4.1.1
>            Reporter: Clinton Nielsen
>            Assignee: Jon Moore
>            Priority: Minor
>             Fix For: 4.1.3, 4.2 Alpha2
>
>         Attachments: HTTPCLIENT-1152.patch
>
>
> org.apache.http.impl.client.cache.memcached.MemcachedHttpCacheStorage
> Original (in getEntry function): 
>   byte[] data = (byte[]) client.get(url);
> Should be:
>   Object obj= client.get(url);
>   if (null == obj || !(objinstanceof byte[])) {
>     return null;
>   }
>   byte[] data = (byte[])obj;
> Original (in updateEntry function):
>   byte[] oldBytes = (v != null) ? (byte[]) v.getValue() : null;
> Should be:
>   byte[] oldBytes = (v != null && (v.getValue() instanceof byte[])) ? (byte[]) v.getValue() : null;
>   

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org