You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@hc.apache.org by "Greg Bowyer (JIRA)" <ji...@apache.org> on 2011/08/12 22:42:27 UTC

[jira] [Created] (HTTPCLIENT-1116) ResponseCachingPolicy uses integers for sizes

ResponseCachingPolicy uses integers for sizes
---------------------------------------------

                 Key: HTTPCLIENT-1116
                 URL: https://issues.apache.org/jira/browse/HTTPCLIENT-1116
             Project: HttpComponents HttpClient
          Issue Type: Bug
          Components: Cache
    Affects Versions: 4.1.1, 4.2 Alpha1
            Reporter: Greg Bowyer


ResponseCachingPolicy currently uses integers for interpreting the size of Content-Length, as well internally.

This causes issues in attempting to use the module for caching entities that are over 2GB in size, the module does not fail gracefully, but throws a NumberFormatException

I have a patch that fixes this, by promoting the int -> long, which should allow for larger entities to be cached, it also updates the public facing API where possible, I don't think that the promotion should break compatibility massively

--
This message is automatically generated by JIRA.
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


Re: [jira] [Commented] (HTTPCLIENT-1116) ResponseCachingPolicy uses integers for sizes

Posted by Bill Speirs <bi...@gmail.com>.
> I really think we are taking a non-issue here. I do not see a point in
> throwing an exception from the old getter method. We break no
> application by not caching entities over Integer#MAX_VALUE because that
> is the normal behavior of the current implementation anyway.

That is a good point!

I retract my previous suggestion...

Bill-

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


RE: [jira] [Commented] (HTTPCLIENT-1116) ResponseCachingPolicy uses integers for sizes

Posted by Oleg Kalnichevski <ol...@apache.org>.
On Mon, 2011-08-15 at 11:26 +0000, Moore, Jonathan (CIM) wrote:
> Another option would be:
> (1) change internal usage to long
> (2) *add* getter/setter using long to CacheConfig (don't replace the int versions)
> 
> This preserves existing functionality but allows for the > 2GB use case.
> 
> Jon

That would not save us from having to decide what to do in case someone
used 'long' setter and 'int' getter. Granted, that would be quite a
silly and a fairly unlikely situation, we ought to deprecate the old
methods nonetheless. 

I really think we are taking a non-issue here. I do not see a point in
throwing an exception from the old getter method. We break no
application by not caching entities over Integer#MAX_VALUE because that
is the normal behavior of the current implementation anyway.

Oleg


> ________________________________________
> From: Bill Speirs [bill.speirs@gmail.com]
> Sent: Sunday, August 14, 2011 9:44 PM
> To: HttpComponents Project
> Subject: Re: [jira] [Commented] (HTTPCLIENT-1116) ResponseCachingPolicy uses integers for sizes
> 
> Why wouldn't you throw an exception? Regardless, people are going to have to
> change their code when dealing with sizes > MAX. With the exception you know
> exactly what the issue is. With returning MAX, it could take the user much
> longer to track down the issue.
> 
> My $0.02...
> 
> Bill-
> 
> On Aug 14, 2011 5:30 PM, "Oleg Kalnichevski (JIRA)" <ji...@apache.org> wrote:
> >
> > [
> https://issues.apache.org/jira/browse/HTTPCLIENT-1116?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13084907#comment-13084907]
> >
> > Oleg Kalnichevski commented on HTTPCLIENT-1116:
> > -----------------------------------------------
> >
> > As far as I can tell the second option should be good enough.
> >
> > Oleg
> >
> >> ResponseCachingPolicy uses integers for sizes
> >> ---------------------------------------------
> >>
> >> Key: HTTPCLIENT-1116
> >> URL: https://issues.apache.org/jira/browse/HTTPCLIENT-1116
> >> Project: HttpComponents HttpClient
> >> Issue Type: Bug
> >> Components: Cache
> >> Affects Versions: 4.1.1, 4.2 Alpha1
> >> Reporter: Greg Bowyer
> >> Labels: cache, policy
> >> Attachments: 0001-Changed-the-ResponseCachingPolicy-to-use-longs.patch
> >>
> >>
> >> ResponseCachingPolicy currently uses integers for interpreting the size
> of Content-Length, as well internally.
> >> This causes issues in attempting to use the module for caching entities
> that are over 2GB in size, the module does not fail gracefully, but throws a
> NumberFormatException
> >> I have a patch that fixes this, by promoting the int -> long, which
> should allow for larger entities to be cached, it also updates the public
> facing API where possible, I don't think that the promotion should break
> compatibility massively
> >> The changes can also be seen here:
> >>
> https://github.com/GregBowyer/httpclient/commit/1197d3f94bd2eedcec32646cd6146748ca2e6fa1
> >
> > --
> > This message is automatically generated by JIRA.
> > 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
> >
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
> For additional commands, e-mail: dev-help@hc.apache.org
> 



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


RE: [jira] [Commented] (HTTPCLIENT-1116) ResponseCachingPolicy uses integers for sizes

Posted by "Moore, Jonathan (CIM)" <Jo...@Comcast.com>.
Another option would be:
(1) change internal usage to long
(2) *add* getter/setter using long to CacheConfig (don't replace the int versions)

This preserves existing functionality but allows for the > 2GB use case.

Jon
________________________________________
From: Bill Speirs [bill.speirs@gmail.com]
Sent: Sunday, August 14, 2011 9:44 PM
To: HttpComponents Project
Subject: Re: [jira] [Commented] (HTTPCLIENT-1116) ResponseCachingPolicy uses integers for sizes

Why wouldn't you throw an exception? Regardless, people are going to have to
change their code when dealing with sizes > MAX. With the exception you know
exactly what the issue is. With returning MAX, it could take the user much
longer to track down the issue.

My $0.02...

Bill-

On Aug 14, 2011 5:30 PM, "Oleg Kalnichevski (JIRA)" <ji...@apache.org> wrote:
>
> [
https://issues.apache.org/jira/browse/HTTPCLIENT-1116?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13084907#comment-13084907]
>
> Oleg Kalnichevski commented on HTTPCLIENT-1116:
> -----------------------------------------------
>
> As far as I can tell the second option should be good enough.
>
> Oleg
>
>> ResponseCachingPolicy uses integers for sizes
>> ---------------------------------------------
>>
>> Key: HTTPCLIENT-1116
>> URL: https://issues.apache.org/jira/browse/HTTPCLIENT-1116
>> Project: HttpComponents HttpClient
>> Issue Type: Bug
>> Components: Cache
>> Affects Versions: 4.1.1, 4.2 Alpha1
>> Reporter: Greg Bowyer
>> Labels: cache, policy
>> Attachments: 0001-Changed-the-ResponseCachingPolicy-to-use-longs.patch
>>
>>
>> ResponseCachingPolicy currently uses integers for interpreting the size
of Content-Length, as well internally.
>> This causes issues in attempting to use the module for caching entities
that are over 2GB in size, the module does not fail gracefully, but throws a
NumberFormatException
>> I have a patch that fixes this, by promoting the int -> long, which
should allow for larger entities to be cached, it also updates the public
facing API where possible, I don't think that the promotion should break
compatibility massively
>> The changes can also be seen here:
>>
https://github.com/GregBowyer/httpclient/commit/1197d3f94bd2eedcec32646cd6146748ca2e6fa1
>
> --
> This message is automatically generated by JIRA.
> 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
>

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


Re: [jira] [Commented] (HTTPCLIENT-1116) ResponseCachingPolicy uses integers for sizes

Posted by Bill Speirs <bi...@gmail.com>.
Why wouldn't you throw an exception? Regardless, people are going to have to
change their code when dealing with sizes > MAX. With the exception you know
exactly what the issue is. With returning MAX, it could take the user much
longer to track down the issue.

My $0.02...

Bill-

On Aug 14, 2011 5:30 PM, "Oleg Kalnichevski (JIRA)" <ji...@apache.org> wrote:
>
> [
https://issues.apache.org/jira/browse/HTTPCLIENT-1116?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13084907#comment-13084907]
>
> Oleg Kalnichevski commented on HTTPCLIENT-1116:
> -----------------------------------------------
>
> As far as I can tell the second option should be good enough.
>
> Oleg
>
>> ResponseCachingPolicy uses integers for sizes
>> ---------------------------------------------
>>
>> Key: HTTPCLIENT-1116
>> URL: https://issues.apache.org/jira/browse/HTTPCLIENT-1116
>> Project: HttpComponents HttpClient
>> Issue Type: Bug
>> Components: Cache
>> Affects Versions: 4.1.1, 4.2 Alpha1
>> Reporter: Greg Bowyer
>> Labels: cache, policy
>> Attachments: 0001-Changed-the-ResponseCachingPolicy-to-use-longs.patch
>>
>>
>> ResponseCachingPolicy currently uses integers for interpreting the size
of Content-Length, as well internally.
>> This causes issues in attempting to use the module for caching entities
that are over 2GB in size, the module does not fail gracefully, but throws a
NumberFormatException
>> I have a patch that fixes this, by promoting the int -> long, which
should allow for larger entities to be cached, it also updates the public
facing API where possible, I don't think that the promotion should break
compatibility massively
>> The changes can also be seen here:
>>
https://github.com/GregBowyer/httpclient/commit/1197d3f94bd2eedcec32646cd6146748ca2e6fa1
>
> --
> This message is automatically generated by JIRA.
> 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-1116) ResponseCachingPolicy uses integers for sizes

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

Greg Bowyer updated HTTPCLIENT-1116:
------------------------------------

    Description: 
ResponseCachingPolicy currently uses integers for interpreting the size of Content-Length, as well internally.

This causes issues in attempting to use the module for caching entities that are over 2GB in size, the module does not fail gracefully, but throws a NumberFormatException

I have a patch that fixes this, by promoting the int -> long, which should allow for larger entities to be cached, it also updates the public facing API where possible, I don't think that the promotion should break compatibility massively

The changes can also be seen here:
https://github.com/GregBowyer/httpclient/commit/1197d3f94bd2eedcec32646cd6146748ca2e6fa1

  was:
ResponseCachingPolicy currently uses integers for interpreting the size of Content-Length, as well internally.

This causes issues in attempting to use the module for caching entities that are over 2GB in size, the module does not fail gracefully, but throws a NumberFormatException

I have a patch that fixes this, by promoting the int -> long, which should allow for larger entities to be cached, it also updates the public facing API where possible, I don't think that the promotion should break compatibility massively


> ResponseCachingPolicy uses integers for sizes
> ---------------------------------------------
>
>                 Key: HTTPCLIENT-1116
>                 URL: https://issues.apache.org/jira/browse/HTTPCLIENT-1116
>             Project: HttpComponents HttpClient
>          Issue Type: Bug
>          Components: Cache
>    Affects Versions: 4.1.1, 4.2 Alpha1
>            Reporter: Greg Bowyer
>              Labels: cache, policy
>         Attachments: 0001-Changed-the-ResponseCachingPolicy-to-use-longs.patch
>
>
> ResponseCachingPolicy currently uses integers for interpreting the size of Content-Length, as well internally.
> This causes issues in attempting to use the module for caching entities that are over 2GB in size, the module does not fail gracefully, but throws a NumberFormatException
> I have a patch that fixes this, by promoting the int -> long, which should allow for larger entities to be cached, it also updates the public facing API where possible, I don't think that the promotion should break compatibility massively
> The changes can also be seen here:
> https://github.com/GregBowyer/httpclient/commit/1197d3f94bd2eedcec32646cd6146748ca2e6fa1

--
This message is automatically generated by JIRA.
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-1116) ResponseCachingPolicy uses integers for sizes

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

Oleg Kalnichevski commented on HTTPCLIENT-1116:
-----------------------------------------------

As far as I can tell the second option should be good enough.

Oleg

> ResponseCachingPolicy uses integers for sizes
> ---------------------------------------------
>
>                 Key: HTTPCLIENT-1116
>                 URL: https://issues.apache.org/jira/browse/HTTPCLIENT-1116
>             Project: HttpComponents HttpClient
>          Issue Type: Bug
>          Components: Cache
>    Affects Versions: 4.1.1, 4.2 Alpha1
>            Reporter: Greg Bowyer
>              Labels: cache, policy
>         Attachments: 0001-Changed-the-ResponseCachingPolicy-to-use-longs.patch
>
>
> ResponseCachingPolicy currently uses integers for interpreting the size of Content-Length, as well internally.
> This causes issues in attempting to use the module for caching entities that are over 2GB in size, the module does not fail gracefully, but throws a NumberFormatException
> I have a patch that fixes this, by promoting the int -> long, which should allow for larger entities to be cached, it also updates the public facing API where possible, I don't think that the promotion should break compatibility massively
> The changes can also be seen here:
> https://github.com/GregBowyer/httpclient/commit/1197d3f94bd2eedcec32646cd6146748ca2e6fa1

--
This message is automatically generated by JIRA.
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-1116) ResponseCachingPolicy uses integers for sizes

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

Oleg Kalnichevski resolved HTTPCLIENT-1116.
-------------------------------------------

    Resolution: Fixed

Patch checked in with minor tweaks to preserve binary compatibility with 4.1

Oleg

> ResponseCachingPolicy uses integers for sizes
> ---------------------------------------------
>
>                 Key: HTTPCLIENT-1116
>                 URL: https://issues.apache.org/jira/browse/HTTPCLIENT-1116
>             Project: HttpComponents HttpClient
>          Issue Type: Bug
>          Components: Cache
>    Affects Versions: 4.1.1
>            Reporter: Greg Bowyer
>              Labels: cache, policy
>             Fix For: 4.2 Alpha1
>
>         Attachments: 0001-Changed-the-ResponseCachingPolicy-to-use-longs.patch
>
>
> ResponseCachingPolicy currently uses integers for interpreting the size of Content-Length, as well internally.
> This causes issues in attempting to use the module for caching entities that are over 2GB in size, the module does not fail gracefully, but throws a NumberFormatException
> I have a patch that fixes this, by promoting the int -> long, which should allow for larger entities to be cached, it also updates the public facing API where possible, I don't think that the promotion should break compatibility massively
> The changes can also be seen here:
> https://github.com/GregBowyer/httpclient/commit/1197d3f94bd2eedcec32646cd6146748ca2e6fa1

--
This message is automatically generated by JIRA.
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-1116) ResponseCachingPolicy uses integers for sizes

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

Oleg Kalnichevski updated HTTPCLIENT-1116:
------------------------------------------

    Affects Version/s:     (was: 4.2 Alpha1)
        Fix Version/s: 4.2 Alpha1

> ResponseCachingPolicy uses integers for sizes
> ---------------------------------------------
>
>                 Key: HTTPCLIENT-1116
>                 URL: https://issues.apache.org/jira/browse/HTTPCLIENT-1116
>             Project: HttpComponents HttpClient
>          Issue Type: Bug
>          Components: Cache
>    Affects Versions: 4.1.1
>            Reporter: Greg Bowyer
>              Labels: cache, policy
>             Fix For: 4.2 Alpha1
>
>         Attachments: 0001-Changed-the-ResponseCachingPolicy-to-use-longs.patch
>
>
> ResponseCachingPolicy currently uses integers for interpreting the size of Content-Length, as well internally.
> This causes issues in attempting to use the module for caching entities that are over 2GB in size, the module does not fail gracefully, but throws a NumberFormatException
> I have a patch that fixes this, by promoting the int -> long, which should allow for larger entities to be cached, it also updates the public facing API where possible, I don't think that the promotion should break compatibility massively
> The changes can also be seen here:
> https://github.com/GregBowyer/httpclient/commit/1197d3f94bd2eedcec32646cd6146748ca2e6fa1

--
This message is automatically generated by JIRA.
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-1116) ResponseCachingPolicy uses integers for sizes

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

Greg Bowyer commented on HTTPCLIENT-1116:
-----------------------------------------

I might be dumb here, but the return type of CacheConfig.getMaxObjectSizeBytes currently returns an int, I cant see how to change that without breaking the API (a little)

Everything else should be fine, but that method poses a problem

> ResponseCachingPolicy uses integers for sizes
> ---------------------------------------------
>
>                 Key: HTTPCLIENT-1116
>                 URL: https://issues.apache.org/jira/browse/HTTPCLIENT-1116
>             Project: HttpComponents HttpClient
>          Issue Type: Bug
>          Components: Cache
>    Affects Versions: 4.1.1, 4.2 Alpha1
>            Reporter: Greg Bowyer
>              Labels: cache, policy
>         Attachments: 0001-Changed-the-ResponseCachingPolicy-to-use-longs.patch
>
>
> ResponseCachingPolicy currently uses integers for interpreting the size of Content-Length, as well internally.
> This causes issues in attempting to use the module for caching entities that are over 2GB in size, the module does not fail gracefully, but throws a NumberFormatException
> I have a patch that fixes this, by promoting the int -> long, which should allow for larger entities to be cached, it also updates the public facing API where possible, I don't think that the promotion should break compatibility massively
> The changes can also be seen here:
> https://github.com/GregBowyer/httpclient/commit/1197d3f94bd2eedcec32646cd6146748ca2e6fa1

--
This message is automatically generated by JIRA.
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-1116) ResponseCachingPolicy uses integers for sizes

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

Greg Bowyer updated HTTPCLIENT-1116:
------------------------------------

    Attachment: 0001-Changed-the-ResponseCachingPolicy-to-use-longs.patch

Made the caching policy use longs instead of ints for content sizes

> ResponseCachingPolicy uses integers for sizes
> ---------------------------------------------
>
>                 Key: HTTPCLIENT-1116
>                 URL: https://issues.apache.org/jira/browse/HTTPCLIENT-1116
>             Project: HttpComponents HttpClient
>          Issue Type: Bug
>          Components: Cache
>    Affects Versions: 4.1.1, 4.2 Alpha1
>            Reporter: Greg Bowyer
>              Labels: cache, policy
>         Attachments: 0001-Changed-the-ResponseCachingPolicy-to-use-longs.patch
>
>
> ResponseCachingPolicy currently uses integers for interpreting the size of Content-Length, as well internally.
> This causes issues in attempting to use the module for caching entities that are over 2GB in size, the module does not fail gracefully, but throws a NumberFormatException
> I have a patch that fixes this, by promoting the int -> long, which should allow for larger entities to be cached, it also updates the public facing API where possible, I don't think that the promotion should break compatibility massively
> The changes can also be seen here:
> https://github.com/GregBowyer/httpclient/commit/1197d3f94bd2eedcec32646cd6146748ca2e6fa1

--
This message is automatically generated by JIRA.
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-1116) ResponseCachingPolicy uses integers for sizes

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

Greg Bowyer commented on HTTPCLIENT-1116:
-----------------------------------------

Ah check, I thought that might add confusion as the API does not appear to have many deprecated methods. I will try to get the done by Monday

If I cast getMaxObjectSizeBytes to an int, whhich is the desirable behaviour if maxObjectSizeBytes > Integer.MAX_VALUE

    - throw an exception
    - return (maxObjectSizeBytes >= Integer.MAX_VALUE) ? Integer.MAX_VALUE : (int) maxObjectSizeBytes
    - allow the thing to miscast and overflow into negative numbers

I think the exception would be the preferred idea, but then that breaks the API at runtime :S
    

> ResponseCachingPolicy uses integers for sizes
> ---------------------------------------------
>
>                 Key: HTTPCLIENT-1116
>                 URL: https://issues.apache.org/jira/browse/HTTPCLIENT-1116
>             Project: HttpComponents HttpClient
>          Issue Type: Bug
>          Components: Cache
>    Affects Versions: 4.1.1, 4.2 Alpha1
>            Reporter: Greg Bowyer
>              Labels: cache, policy
>         Attachments: 0001-Changed-the-ResponseCachingPolicy-to-use-longs.patch
>
>
> ResponseCachingPolicy currently uses integers for interpreting the size of Content-Length, as well internally.
> This causes issues in attempting to use the module for caching entities that are over 2GB in size, the module does not fail gracefully, but throws a NumberFormatException
> I have a patch that fixes this, by promoting the int -> long, which should allow for larger entities to be cached, it also updates the public facing API where possible, I don't think that the promotion should break compatibility massively
> The changes can also be seen here:
> https://github.com/GregBowyer/httpclient/commit/1197d3f94bd2eedcec32646cd6146748ca2e6fa1

--
This message is automatically generated by JIRA.
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-1116) ResponseCachingPolicy uses integers for sizes

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

Oleg Kalnichevski commented on HTTPCLIENT-1116:
-----------------------------------------------

Greg,
There is certainly a way to fix the problem without breaking API compatibility at all, which would be preferred.

Oleg

> ResponseCachingPolicy uses integers for sizes
> ---------------------------------------------
>
>                 Key: HTTPCLIENT-1116
>                 URL: https://issues.apache.org/jira/browse/HTTPCLIENT-1116
>             Project: HttpComponents HttpClient
>          Issue Type: Bug
>          Components: Cache
>    Affects Versions: 4.1.1, 4.2 Alpha1
>            Reporter: Greg Bowyer
>              Labels: cache, policy
>         Attachments: 0001-Changed-the-ResponseCachingPolicy-to-use-longs.patch
>
>
> ResponseCachingPolicy currently uses integers for interpreting the size of Content-Length, as well internally.
> This causes issues in attempting to use the module for caching entities that are over 2GB in size, the module does not fail gracefully, but throws a NumberFormatException
> I have a patch that fixes this, by promoting the int -> long, which should allow for larger entities to be cached, it also updates the public facing API where possible, I don't think that the promotion should break compatibility massively
> The changes can also be seen here:
> https://github.com/GregBowyer/httpclient/commit/1197d3f94bd2eedcec32646cd6146748ca2e6fa1

--
This message is automatically generated by JIRA.
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-1116) ResponseCachingPolicy uses integers for sizes

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

Oleg Kalnichevski commented on HTTPCLIENT-1116:
-----------------------------------------------

Change internal representation of maxObjectSizeBytes from int to long, deprecate CacheConfig.getMaxObjectSizeBytes make it return maxObjectSizeBytes value cast to int, add another method with a similar name (say CacheConfig#getMaxObjectSize) that returns maxObjectSizeBytes as long, do the same for setters, make sure HttpClient cache classes use new methods only.

I think this should do the trick.

Oleg

> ResponseCachingPolicy uses integers for sizes
> ---------------------------------------------
>
>                 Key: HTTPCLIENT-1116
>                 URL: https://issues.apache.org/jira/browse/HTTPCLIENT-1116
>             Project: HttpComponents HttpClient
>          Issue Type: Bug
>          Components: Cache
>    Affects Versions: 4.1.1, 4.2 Alpha1
>            Reporter: Greg Bowyer
>              Labels: cache, policy
>         Attachments: 0001-Changed-the-ResponseCachingPolicy-to-use-longs.patch
>
>
> ResponseCachingPolicy currently uses integers for interpreting the size of Content-Length, as well internally.
> This causes issues in attempting to use the module for caching entities that are over 2GB in size, the module does not fail gracefully, but throws a NumberFormatException
> I have a patch that fixes this, by promoting the int -> long, which should allow for larger entities to be cached, it also updates the public facing API where possible, I don't think that the promotion should break compatibility massively
> The changes can also be seen here:
> https://github.com/GregBowyer/httpclient/commit/1197d3f94bd2eedcec32646cd6146748ca2e6fa1

--
This message is automatically generated by JIRA.
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