On Tue, 8 Mar 2022 12:56:50 GMT, Sean Mullan <mul...@openjdk.org> wrote:

>> test/jdk/sun/security/util/HostnameChecker/Wildcard.java line 72:
>> 
>>> 70:         } catch (Exception e) {
>>> 71:             if (expected) {
>>> 72:                 throw new Exception("unexpectedly failed match", e);
>> 
>> consider to update these to RuntimeException
>
> What are the benefits of throwing `RuntimeException` instead of `Exception`? 
> In the latest commit, I have merged the `Wildcard.java` test into 
> `TestHostnameChecker.java` test which already throws `Exception` on failures.

It's not essential. RuntimeException is a convenient choice since it's 
unchecked, so you don't have to sprinkle your code with throws clauses.

https://openjdk.java.net/jtreg/faq.html#if-a-test-fails-do-i-have-to-throw-my-own-exception

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

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

Reply via email to