URLConnection.getRequestProperties() doesn't throw as promised

Michael McMahon michael.x.mcmahon at oracle.com
Fri May 21 01:56:29 PDT 2010


Michael McMahon wrote:
> Martin Buchholz wrote:
>> Hi net-dev gang,
>>
>> A colleague reports that:
>>
>> URLConnection.getRequestProperties() promises to throw an
>> IllegalStateException when invoked on a connected instance. But Java 6
>> returns a valid map.
>>
>> Can you get either the spec or the implementation fixed so that the 
>> two agree?
>>
>> Thanks,
>>
>> Martin
>>   
> I checked this and I agree that when a HttpURLConnection is connected,
> ISE is thrown when you call getRequestProperties(). Then, after you call
> disconnect(), getRequestProperties() returns a valid map.
>
> This probably wasn't the intended behavior, but I don't think there is 
> any upside
> in changing it, given the potential for breaking running code.
>
> I propose we change the spec. to be compatible with the current behavior.
>
> - Michael.
CR 6954610 has been submitted for this issue.

Thanks,
Michael.



More information about the net-dev mailing list