catch EOFException during import

This commit is contained in:
Thialfihar 2010-05-21 14:42:12 +00:00
parent 97745873e7
commit 71f5af31e4

View File

@ -19,6 +19,7 @@ package org.thialfihar.android.apg;
import java.io.BufferedInputStream; import java.io.BufferedInputStream;
import java.io.ByteArrayInputStream; import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream; import java.io.ByteArrayOutputStream;
import java.io.EOFException;
import java.io.File; import java.io.File;
import java.io.FileInputStream; import java.io.FileInputStream;
import java.io.FileNotFoundException; import java.io.FileNotFoundException;
@ -711,6 +712,7 @@ public class Apg {
BufferedInputStream bufferedInput = new BufferedInputStream(progressIn); BufferedInputStream bufferedInput = new BufferedInputStream(progressIn);
int newKeys = 0; int newKeys = 0;
int oldKeys = 0; int oldKeys = 0;
try {
while (true) { while (true) {
InputStream in = PGPUtil.getDecoderStream(bufferedInput); InputStream in = PGPUtil.getDecoderStream(bufferedInput);
PGPObjectFactory objectFactory = new PGPObjectFactory(in); PGPObjectFactory objectFactory = new PGPObjectFactory(in);
@ -747,6 +749,9 @@ public class Apg {
obj = objectFactory.nextObject(); obj = objectFactory.nextObject();
} }
} }
} catch (EOFException e) {
// nothing to do, we are done
}
progress.setProgress(R.string.progress_reloadingKeys, 100, 100); progress.setProgress(R.string.progress_reloadingKeys, 100, 100);
loadKeyRings(context, type); loadKeyRings(context, type);