You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@harmony.apache.org by Leo Li <li...@gmail.com> on 2006/11/02 03:55:41 UTC

[classlib][luni]HttpURLConnection.getRequestProperty(String) and HttpURLConnection.getRequestProperties() should throw IllegalStateException while connected or not?

Hi, all

     While cleaning the jira 1687, I found that the spec says if connected,
both functions should throw IllegalStateException, while RI throws it in
HttpURLConnection.getRequestProperties()  but
HttpURLConnection.getRequestProperty(String) not.

     Although personally I would like not to throw exception in both cases
since it will not do harm to get properties for request after connected, I
will still follow RI although the manner is a little odd if no one objects.


Leo Li
China Software Development Lab, IBM

Re: [classlib][luni]HttpURLConnection.getRequestProperty(String) and HttpURLConnection.getRequestProperties() should throw IllegalStateException while connected or not?

Posted by Spark Shen <sm...@gmail.com>.
Leo Li 写道:
> Hi, all
>
> While cleaning the jira 1687, I found that the spec says if connected,
> both functions should throw IllegalStateException, while RI throws it in
> HttpURLConnection.getRequestProperties() but
> HttpURLConnection.getRequestProperty(String) not.
>
> Although personally I would like not to throw exception in both cases
I am not sure whether throw Exceptions or return null value is better. 
They demonstrates different error handling mechanism.
Now that, we could not predict which mechanism users will adopt, follow 
RI's behavior is safer.

Best regards
> since it will not do harm to get properties for request after 
> connected, I
> will still follow RI although the manner is a little odd if no one 
> objects.
>
>
> Leo Li
> China Software Development Lab, IBM
>


-- 
Spark Shen
China Software Development Lab, IBM