Skip to content

Commit 6b3c1e0

Browse files
author
Alexey Semenyuk
committed
8373833: "error.cert.not.found" and "error.explicit-sign-no-cert" errors duplicate each other
Reviewed-by: almatvee
1 parent 7c979c1 commit 6b3c1e0

File tree

3 files changed

+7
-16
lines changed

3 files changed

+7
-16
lines changed

src/jdk.jpackage/macosx/classes/jdk/jpackage/internal/SigningIdentityBuilder.java

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2025, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2025, 2026, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -40,6 +40,7 @@
4040
import javax.security.auth.x500.X500Principal;
4141
import jdk.jpackage.internal.MacCertificateUtils.CertificateHash;
4242
import jdk.jpackage.internal.model.ConfigException;
43+
import jdk.jpackage.internal.model.JPackageException;
4344
import jdk.jpackage.internal.model.SigningIdentity;
4445

4546
final class SigningIdentityBuilder {
@@ -147,11 +148,9 @@ private static X509Certificate selectSigningIdentity(List<X509Certificate> certs
147148
Objects.requireNonNull(keychain);
148149
switch (certs.size()) {
149150
case 0 -> {
150-
var errMsg = I18N.format("error.cert.not.found", certificateSelector.signingIdentities().getFirst(),
151-
keychain.map(Keychain::name).orElse(""));
152-
Log.error(I18N.format("message.error-header", errMsg));
153-
throw I18N.buildConfigException("error.explicit-sign-no-cert")
154-
.advice("error.explicit-sign-no-cert.advice").create();
151+
throw new JPackageException(I18N.format("error.cert.not.found",
152+
certificateSelector.signingIdentities().getFirst(),
153+
keychain.map(Keychain::name).orElse("")));
155154
}
156155
case 1 -> {
157156
return certs.getFirst();

src/jdk.jpackage/macosx/classes/jdk/jpackage/internal/resources/MacResources.properties

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#
2-
# Copyright (c) 2017, 2025, Oracle and/or its affiliates. All rights reserved.
2+
# Copyright (c) 2017, 2026, Oracle and/or its affiliates. All rights reserved.
33
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
#
55
# This code is free software; you can redistribute it and/or modify it
@@ -24,8 +24,6 @@
2424
#
2525
#
2626
error.invalid-cfbundle-version.advice=Set a compatible 'app-version' value. Valid versions are one to three integers separated by dots.
27-
error.explicit-sign-no-cert=Signature explicitly requested but no signing certificate found
28-
error.explicit-sign-no-cert.advice=Specify a valid mac-signing-key-user-name and mac-signing-keychain
2927
error.certificate.expired=Certificate expired {0}
3028
error.cert.not.found=No certificate found matching [{0}] using keychain [{1}]
3129
error.multiple.certs.found=Multiple certificates matching name [{0}] found in keychain [{1}]

test/jdk/tools/jpackage/share/ErrorTest.java

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2020, 2025, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2020, 2026, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -707,12 +707,6 @@ public static void testMacSigningIdentityValidation(PackageType type, String opt
707707
final List<CannedFormattedString> errorMessages = new ArrayList<>();
708708
errorMessages.add(makeError(JPackageStringBundle.MAIN.cannedFormattedString(
709709
"error.cert.not.found", "Developer ID Application: " + signingId, "")));
710-
errorMessages.addAll(Stream.of(
711-
Map.<String, UnaryOperator<CannedFormattedString>>entry("error.explicit-sign-no-cert", JPackageCommand::makeError),
712-
Map.<String, UnaryOperator<CannedFormattedString>>entry("error.explicit-sign-no-cert.advice", JPackageCommand::makeAdvice)
713-
).map(e -> {
714-
return e.getValue().apply(JPackageStringBundle.MAIN.cannedFormattedString(e.getKey()));
715-
}).toList());
716710

717711
final var cmd = JPackageCommand.helloAppImage()
718712
.ignoreDefaultVerbose(true)

0 commit comments

Comments
 (0)