RFR: 8349534: Refactor jdk/sun/security/krb5/runNameEquals.sh to java test

Matthew Donovan mdonovan at openjdk.org
Mon Feb 10 18:38:21 UTC 2025


On Mon, 10 Feb 2025 17:50:21 GMT, Mikhail Yankelevich <duke at openjdk.org> wrote:

> Refactored the runNameEquals.sh to java test

test/jdk/sun/security/krb5/Krb5NameEquals.java line 94:

> 92: 
> 93:                     if (installationIssue) {
> 94:                         System.out.println("""

You should probably throw a SkippedException instead.

test/jdk/sun/security/krb5/Krb5NameEquals.java line 125:

> 123:             Oid temp = null;
> 124:             try {
> 125:                 temp = new Oid("1.2.840.113554.1.2.2"); // KRB5

You can't just set `MECH = new Oid(...);`?

test/jdk/sun/security/krb5/Krb5NameEquals.java line 145:

> 143:                     GSSName.NT_HOSTBASED_SERVICE, MECH);
> 144: 
> 145:             if (!name1.equals(name1) || !name1.equals(name3) ||

I don't know much about kerberos but is there ever a chance that `name1.equals(name1)` is false? And the same with name3 which looks to be created the same exact was as name1?

test/jdk/sun/security/krb5/Krb5NameEquals.java line 148:

> 146:                 !name1.equals((Object) name1) ||
> 147:                 !name1.equals((Object) name3)) {
> 148:                 System.out.println("Error: should be the same name");

You can just throw exceptions and the exit code of the Java process with be 1 and the stack trace will be in the log.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/23542#discussion_r1949665390
PR Review Comment: https://git.openjdk.org/jdk/pull/23542#discussion_r1949671597
PR Review Comment: https://git.openjdk.org/jdk/pull/23542#discussion_r1949677053
PR Review Comment: https://git.openjdk.org/jdk/pull/23542#discussion_r1949680536


More information about the security-dev mailing list