Right, what I have now should not be really problematic, it will throw an OutOfMemoryError and I pass the test in that case. But
I am ok with skipping it too.

I'll just push the source code change then.

- Kurchi

On 6/12/2013 11:37 AM, Chris Hegarty wrote:
On 12 Jun 2013, at 19:29, Chris Hegarty <chris.hega...@oracle.com> wrote:

The source change looks fine to me, since our implementation treats the given chunk 
length as the complete chunk size ( including header & footer ).

I would prefer to not add a test, if the test will end up being problematic, 
given this is a corner case.
I mean, when running tests in the samevm concurrently.

-Chris

-Chris

On 12 Jun 2013, at 18:48, Kurchi Hazra <kurchi.subhra.ha...@oracle.com> wrote:



Hi,

In HttpUrlConnection, if the chunk length is set to Integer.MAX_VALUE, our code 
was trying to initialize a buffer of size
greater than that, which was resulting in an integer overflow, and consequently 
a NegativeArraySizeException. This fix
ensures that while initializing the internal buffer, we never exceed the 
maximum size of the chunk length fixed by the user,
and hence avert the NegativeArraySizeException.

I have added a test to cover the case. The test will however try to create a 
buffer of size Integer.MAX_VALUE. I could
change the value of the JVM heap, but the required size (~2 GB) will be too 
large for most machines to support.
However, I am open to advice as to what I should do in this case.

Bug: http://bugs.sun.com/view_bug.do?bug_id=8015421
Webrev: http://cr.openjdk.java.net/~khazra/8015421/webrev.00/



Thanks,
Kurchi

--
-Kurchi

Reply via email to