1
0
Fork 0
mirror of https://github.com/pgpainless/pgpainless.git synced 2025-12-16 09:11:08 +01:00

Move Shared PGP Certificate Directory Exceptions to pgp certificate store

This commit is contained in:
Paul Schaub 2022-02-13 20:44:04 +01:00
parent 0c5cad677c
commit 983f39c56f
17 changed files with 88 additions and 197 deletions

View file

@ -9,7 +9,7 @@ import org.pgpainless.certificate_store.SharedPGPCertificateDirectoryAdapter;
import pgp.cert_d.SharedPGPCertificateDirectoryImpl;
import pgp.cert_d.cli.commands.Get;
import pgp.cert_d.cli.commands.Import;
import pgp.cert_d.exception.NotAStoreException;
import pgp.certificate_store.exception.NotAStoreException;
import pgp.certificate_store.CertificateStore;
import picocli.CommandLine;

View file

@ -11,6 +11,8 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import pgp.cert_d.cli.PGPCertDCli;
import pgp.certificate_store.Certificate;
import pgp.certificate_store.exception.BadDataException;
import pgp.certificate_store.exception.BadNameException;
import picocli.CommandLine;
@CommandLine.Command(name = "get",
@ -36,7 +38,13 @@ public class Get implements Runnable {
}
Streams.pipeAll(certificate.getInputStream(), System.out);
} catch (IOException e) {
LOGGER.info("IO Error", e);
LOGGER.error("IO Error", e);
System.exit(-1);
} catch (BadDataException e) {
LOGGER.error("Certificate file contains bad data.", e);
System.exit(-1);
} catch (BadNameException e) {
LOGGER.error("Certificate fingerprint mismatch.", e);
System.exit(-1);
}
}

View file

@ -11,6 +11,7 @@ import org.slf4j.LoggerFactory;
import pgp.cert_d.cli.PGPCertDCli;
import pgp.certificate_store.Certificate;
import pgp.certificate_store.MergeCallback;
import pgp.certificate_store.exception.BadDataException;
import picocli.CommandLine;
@CommandLine.Command(name = "import",
@ -32,10 +33,13 @@ public class Import implements Runnable {
System.out.println(certificate.getFingerprint());
// CHECKSTYLE:ON
} catch (IOException e) {
LOGGER.info("IO-Error", e);
LOGGER.error("IO-Error.", e);
System.exit(-1);
} catch (InterruptedException e) {
LOGGER.info("Thread interrupted.", e);
LOGGER.error("Thread interrupted.", e);
System.exit(-1);
} catch (BadDataException e) {
LOGGER.error("Certificate contains bad data.", e);
System.exit(-1);
}
}