On Wed, 4 Nov 2020 15:42:54 GMT, Daniel Fuchs <dfu...@openjdk.org> wrote:

>> src/java.net.http/share/classes/java/net/http/HttpRequest.java line 344:
>> 
>>> 342:             throw ex;
>>> 343:         } catch (RuntimeException r) {
>>> 344:             throw new IllegalArgumentException("Illegal request 
>>> parameters", r);
>> 
>> I'm a little concerned about this. It seems unnecessary, and adds complexity 
>> to an otherwise straightforward piece of code. Any accessor of the given 
>> request that throws should probably just be allowed to flow out. If needed, 
>> we could even mention that in the specification.
>
> The current code side step the issue of having to explain in the spec that 
> any kind of `RuntimeException` could be propagated upwards. With this, 
> calling code can just try catch `IAE`. It's a little more user-friendly.

Having discussed this offline, it was decided that we should remove the 
try/catch altogether. This change can be viewed in commit 
https://github.com/openjdk/jdk/pull/1059/commits/cabc0e700953058219cd0188faccdda12a7d0398

-------------

PR: https://git.openjdk.java.net/jdk/pull/1059

Reply via email to