mirror of
https://github.com/vanitasvitae/Smack.git
synced 2024-11-25 21:42:07 +01:00
Do not mask FileNotFoundException in FileBasedOpenPgpKeyStore
This commit is contained in:
parent
fe9d2daed2
commit
d133f25ca6
1 changed files with 4 additions and 10 deletions
|
@ -113,13 +113,10 @@ public class FileBasedOpenPgpKeyStore extends AbstractOpenPgpKeyStore {
|
||||||
public PGPPublicKeyRingCollection readPublicKeysOf(BareJid owner)
|
public PGPPublicKeyRingCollection readPublicKeysOf(BareJid owner)
|
||||||
throws IOException, PGPException {
|
throws IOException, PGPException {
|
||||||
File file = getPublicKeyRingPath(owner);
|
File file = getPublicKeyRingPath(owner);
|
||||||
|
if (!file.exists()) {
|
||||||
FileInputStream inputStream;
|
|
||||||
try {
|
|
||||||
inputStream = FileUtils.prepareFileInputStream(file);
|
|
||||||
} catch (FileNotFoundException e) {
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
FileInputStream inputStream = FileUtils.prepareFileInputStream(file);
|
||||||
|
|
||||||
PGPPublicKeyRingCollection collection = PGPainless.readKeyRing().publicKeyRingCollection(inputStream);
|
PGPPublicKeyRingCollection collection = PGPainless.readKeyRing().publicKeyRingCollection(inputStream);
|
||||||
inputStream.close();
|
inputStream.close();
|
||||||
|
@ -129,13 +126,10 @@ public class FileBasedOpenPgpKeyStore extends AbstractOpenPgpKeyStore {
|
||||||
@Override
|
@Override
|
||||||
public PGPSecretKeyRingCollection readSecretKeysOf(BareJid owner) throws IOException, PGPException {
|
public PGPSecretKeyRingCollection readSecretKeysOf(BareJid owner) throws IOException, PGPException {
|
||||||
File file = getSecretKeyRingPath(owner);
|
File file = getSecretKeyRingPath(owner);
|
||||||
|
if (!file.exists()) {
|
||||||
FileInputStream inputStream;
|
|
||||||
try {
|
|
||||||
inputStream = FileUtils.prepareFileInputStream(file);
|
|
||||||
} catch (FileNotFoundException e) {
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
FileInputStream inputStream = FileUtils.prepareFileInputStream(file);
|
||||||
|
|
||||||
PGPSecretKeyRingCollection collection = PGPainless.readKeyRing().secretKeyRingCollection(inputStream);
|
PGPSecretKeyRingCollection collection = PGPainless.readKeyRing().secretKeyRingCollection(inputStream);
|
||||||
inputStream.close();
|
inputStream.close();
|
||||||
|
|
Loading…
Reference in a new issue