diff options
author | Thomas Wolf <twolf@apache.org> | 2024-12-20 19:26:40 +0100 |
---|---|---|
committer | Thomas Wolf <twolf@apache.org> | 2024-12-20 19:26:40 +0100 |
commit | 2ec1dc20ec71daa33007fb0fa62eff96eabf8254 (patch) | |
tree | 22fb6ac6b0d2c7340af183dd57585d7849e12e87 | |
parent | e7e633c480c47665937b4b3d954bb23e85dcd96e (diff) | |
download | jgit-2ec1dc20ec71daa33007fb0fa62eff96eabf8254.tar.gz jgit-2ec1dc20ec71daa33007fb0fa62eff96eabf8254.zip |
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
-rw-r--r-- | org.eclipse.jgit/src/org/eclipse/jgit/util/SignatureUtils.java | 15 |
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))); |