RFR: 7192189: Support endpoint identification algorithm in RFC 6125 [v2]

Rajan Halade rhalade at openjdk.java.net
Tue Mar 8 18:04:04 UTC 2022


On Tue, 8 Mar 2022 12:56:50 GMT, Sean Mullan <mullan at 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



More information about the security-dev mailing list