From 9475285013accafd24d5bc14da9ba01ca218cbe8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dominik=20Sch=C3=BCrmann?= Date: Thu, 31 Jul 2014 17:11:06 +0200 Subject: Better exception handling for import of keys --- .../org/sufficientlysecure/keychain/pgp/UncachedKeyRing.java | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'OpenKeychain/src/main/java/org/sufficientlysecure/keychain/pgp/UncachedKeyRing.java') diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/pgp/UncachedKeyRing.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/pgp/UncachedKeyRing.java index de8c683ff..0e59b7fdb 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/pgp/UncachedKeyRing.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/pgp/UncachedKeyRing.java @@ -134,9 +134,7 @@ public class UncachedKeyRing { } - public static List fromStream(InputStream stream) - throws PgpGeneralException, IOException { - + public static List fromStream(InputStream stream) throws IOException { List result = new Vector(); while(stream.available() > 0) { @@ -147,8 +145,10 @@ public class UncachedKeyRing { while ((obj = objectFactory.nextObject()) != null) { Log.d(Constants.TAG, "Found class: " + obj.getClass()); if (!(obj instanceof PGPKeyRing)) { - throw new PgpGeneralException( - "Bad object of type " + obj.getClass().getName() + " in stream!"); + Log.d(Constants.TAG, + "Bad object of type " + obj.getClass().getName() + " in stream, proceed with next object..."); + // skip object + continue; } result.add(new UncachedKeyRing((PGPKeyRing) obj)); } -- cgit v1.2.3