diff options
author | Vincent Breitmoser <valodim@mugenguild.com> | 2015-01-02 02:05:12 +0100 |
---|---|---|
committer | Vincent Breitmoser <valodim@mugenguild.com> | 2015-01-02 02:05:12 +0100 |
commit | 56f2a3137bbe56fee328bfbece625cf4a2f9e51d (patch) | |
tree | c820b25109bbd3dec52e95601059417a4df52bb3 /OpenKeychain-Test/src/test/java | |
parent | b52fb903803c2dfca578c140dfdc776927c6fc4b (diff) | |
download | open-keychain-56f2a3137bbe56fee328bfbece625cf4a2f9e51d.tar.gz open-keychain-56f2a3137bbe56fee328bfbece625cf4a2f9e51d.tar.bz2 open-keychain-56f2a3137bbe56fee328bfbece625cf4a2f9e51d.zip |
get rid of RuntimeException control flow in UncachedKeyRing.fromStream
Diffstat (limited to 'OpenKeychain-Test/src/test/java')
2 files changed, 5 insertions, 7 deletions
diff --git a/OpenKeychain-Test/src/test/java/org/sufficientlysecure/keychain/operations/ExportTest.java b/OpenKeychain-Test/src/test/java/org/sufficientlysecure/keychain/operations/ExportTest.java index 8ac23b1ee..4470ef411 100644 --- a/OpenKeychain-Test/src/test/java/org/sufficientlysecure/keychain/operations/ExportTest.java +++ b/OpenKeychain-Test/src/test/java/org/sufficientlysecure/keychain/operations/ExportTest.java @@ -33,6 +33,7 @@ import org.sufficientlysecure.keychain.operations.results.OperationResult.Operat import org.sufficientlysecure.keychain.pgp.CanonicalizedPublicKeyRing; import org.sufficientlysecure.keychain.pgp.PgpKeyOperation; import org.sufficientlysecure.keychain.pgp.UncachedKeyRing; +import org.sufficientlysecure.keychain.pgp.UncachedKeyRing.IteratorWithIOThrow; import org.sufficientlysecure.keychain.pgp.WrappedSignature; import org.sufficientlysecure.keychain.provider.ProviderHelper; import org.sufficientlysecure.keychain.service.SaveKeyringParcel; @@ -141,7 +142,7 @@ public class ExportTest { masterKeyId1 = mStaticRing2.getMasterKeyId(); } - Iterator<UncachedKeyRing> unc = + IteratorWithIOThrow<UncachedKeyRing> unc = UncachedKeyRing.fromStream(new ByteArrayInputStream(out.toByteArray())); { diff --git a/OpenKeychain-Test/src/test/java/org/sufficientlysecure/keychain/pgp/UncachedKeyringTest.java b/OpenKeychain-Test/src/test/java/org/sufficientlysecure/keychain/pgp/UncachedKeyringTest.java index 89fefb767..e5c00221b 100644 --- a/OpenKeychain-Test/src/test/java/org/sufficientlysecure/keychain/pgp/UncachedKeyringTest.java +++ b/OpenKeychain-Test/src/test/java/org/sufficientlysecure/keychain/pgp/UncachedKeyringTest.java @@ -27,6 +27,7 @@ import org.robolectric.RobolectricTestRunner; import org.robolectric.shadows.ShadowLog; import org.spongycastle.bcpg.sig.KeyFlags; import org.sufficientlysecure.keychain.operations.results.EditKeyResult; +import org.sufficientlysecure.keychain.pgp.UncachedKeyRing.IteratorWithIOThrow; import org.sufficientlysecure.keychain.pgp.exception.PgpGeneralException; import org.sufficientlysecure.keychain.service.SaveKeyringParcel; import org.sufficientlysecure.keychain.service.SaveKeyringParcel.Algorithm; @@ -110,7 +111,7 @@ public class UncachedKeyringTest { ring.encodeArmored(out, "OpenKeychain"); pubRing.encodeArmored(out, "OpenKeychain"); - Iterator<UncachedKeyRing> it = + IteratorWithIOThrow<UncachedKeyRing> it = UncachedKeyRing.fromStream(new ByteArrayInputStream(out.toByteArray())); Assert.assertTrue("there should be two rings in the stream", it.hasNext()); Assert.assertArrayEquals("first ring should be the first we put in", @@ -139,11 +140,7 @@ public class UncachedKeyringTest { } UncachedKeyRing readRingFromResource(String name) throws Throwable { - try { - return UncachedKeyRing.fromStream(UncachedKeyringTest.class.getResourceAsStream(name)).next(); - } catch (RuntimeException e) { - throw e.getCause(); - } + return UncachedKeyRing.fromStream(UncachedKeyringTest.class.getResourceAsStream(name)).next(); } } |