1
0
Fork 0
mirror of https://codeberg.org/Mercury-IM/Smack synced 2024-11-22 06:12:05 +01:00

Do not mask FileNotFoundException in FileBasedOpenPgpKeyStore

This commit is contained in:
Florian Schmaus 2018-08-17 12:23:20 +02:00
parent fe9d2daed2
commit d133f25ca6

View file

@ -113,13 +113,10 @@ public class FileBasedOpenPgpKeyStore extends AbstractOpenPgpKeyStore {
public PGPPublicKeyRingCollection readPublicKeysOf(BareJid owner)
throws IOException, PGPException {
File file = getPublicKeyRingPath(owner);
FileInputStream inputStream;
try {
inputStream = FileUtils.prepareFileInputStream(file);
} catch (FileNotFoundException e) {
if (!file.exists()) {
return null;
}
FileInputStream inputStream = FileUtils.prepareFileInputStream(file);
PGPPublicKeyRingCollection collection = PGPainless.readKeyRing().publicKeyRingCollection(inputStream);
inputStream.close();
@ -129,13 +126,10 @@ public class FileBasedOpenPgpKeyStore extends AbstractOpenPgpKeyStore {
@Override
public PGPSecretKeyRingCollection readSecretKeysOf(BareJid owner) throws IOException, PGPException {
File file = getSecretKeyRingPath(owner);
FileInputStream inputStream;
try {
inputStream = FileUtils.prepareFileInputStream(file);
} catch (FileNotFoundException e) {
if (!file.exists()) {
return null;
}
FileInputStream inputStream = FileUtils.prepareFileInputStream(file);
PGPSecretKeyRingCollection collection = PGPainless.readKeyRing().secretKeyRingCollection(inputStream);
inputStream.close();