aboutsummaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit/src/org
diff options
context:
space:
mode:
authorThomas Wolf <twolf@apache.org>2024-12-20 19:26:40 +0100
committerThomas Wolf <twolf@apache.org>2024-12-20 19:26:40 +0100
commit2ec1dc20ec71daa33007fb0fa62eff96eabf8254 (patch)
tree22fb6ac6b0d2c7340af183dd57585d7849e12e87 /org.eclipse.jgit/src/org
parente7e633c480c47665937b4b3d954bb23e85dcd96e (diff)
downloadjgit-master.tar.gz
jgit-master.zip
SignatureUtils.toString(): allow null signature creation dateHEADmaster
Some signatures may not have a "created at" timestamp, or the tool used to verify the signature does not report it. If we get none, do not report anything about the signature creation time. This can happen for instance if 'smimesign' is used for verifying x509 signatures. Change-Id: I1a63aa62ffe173e00f27e8aea539b26cd40387c0
Diffstat (limited to 'org.eclipse.jgit/src/org')
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/util/SignatureUtils.java15
1 files changed, 9 insertions, 6 deletions
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/util/SignatureUtils.java b/org.eclipse.jgit/src/org/eclipse/jgit/util/SignatureUtils.java
index 90524db20a..820ac2db91 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/util/SignatureUtils.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/util/SignatureUtils.java
@@ -45,12 +45,15 @@ public final class SignatureUtils {
public static String toString(SignatureVerification verification,
PersonIdent creator, GitDateFormatter formatter) {
StringBuilder result = new StringBuilder();
- // Use the creator's timezone for the signature date
- PersonIdent dateId = new PersonIdent(creator,
- verification.creationDate());
- result.append(MessageFormat.format(JGitText.get().verifySignatureMade,
- formatter.formatDate(dateId)));
- result.append('\n');
+ if (verification.creationDate() != null) {
+ // Use the creator's timezone for the signature date
+ PersonIdent dateId = new PersonIdent(creator,
+ verification.creationDate());
+ result.append(
+ MessageFormat.format(JGitText.get().verifySignatureMade,
+ formatter.formatDate(dateId)));
+ result.append('\n');
+ }
result.append(MessageFormat.format(
JGitText.get().verifySignatureKey,
verification.keyFingerprint().toUpperCase(Locale.ROOT)));