Skip to content

Commit

Permalink
Use catch-syntax capabilities for instance checking.
Browse files Browse the repository at this point in the history
  • Loading branch information
cobratbq committed May 11, 2020
1 parent c49d239 commit b6636ad
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/main/java/org/simplify4u/plugins/PGPVerifyMojo.java
Original file line number Diff line number Diff line change
Expand Up @@ -467,9 +467,9 @@ private boolean verifyPGPSignature(Artifact artifact, Artifact ascArtifact) thro
+ " signature.hashAlgorithm: " + pgpSignature.getHashAlgorithm());

return verifySignatureStatus(pgpSignature.verify(), artifact, publicKey, publicKeyRing);
} catch (IOException | PGPException e) {
if (e.getCause() instanceof PGPKeyNotFound && keysMap.isKeyMissing(artifact)) {
final String logMessage = String.format("%s PGP Key not found on server, consistent with keys map.",
} catch (PGPKeyNotFound e) {
if (keysMap.isKeyMissing(artifact)) {
final String logMessage = String.format("%s PGP key not found on server, consistent with keys map.",
artifact.getId());
if (quiet) {
getLog().debug(logMessage);
Expand All @@ -478,6 +478,9 @@ private boolean verifyPGPSignature(Artifact artifact, Artifact ascArtifact) thro
}
return true;
}
throw new MojoFailureException("Failed to process signature '" + signatureFile + "' for artifact "
+ artifact.getId() + ": cannot find public key on keyserver.", e);
} catch (IOException | PGPException e) {
throw new MojoFailureException("Failed to process signature '" + signatureFile + "' for artifact "
+ artifact.getId(), e);
}
Expand Down

0 comments on commit b6636ad

Please sign in to comment.