mirror of
https://codeberg.org/Mercury-IM/Smack
synced 2025-09-10 10:49:41 +02:00
smack-omemo*: Do not swallow IOException deep within the library
Those exception are caused by I/O operations in the OmemoStore, which is now declaring that it throws those (since it is not uncommon for I/O operations to cause IOExceptions). After all, this is nicely demonstrated as this change is caused by switching with this commit to the Android API 19 compatible methods in FileBasedOmemoStore, which throw. The library can not decide what to do in case of those exceptions, hence it is sensible to expose them to the user.
This commit is contained in:
parent
699905a1de
commit
1bce378e6d
16 changed files with 299 additions and 331 deletions
|
@ -19,6 +19,7 @@ package org.jivesoftware.smackx.omemo;
|
|||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertFalse;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.logging.Level;
|
||||
|
||||
import org.jivesoftware.smack.SmackException;
|
||||
|
@ -64,7 +65,7 @@ public abstract class AbstractTwoUsersOmemoIntegrationTest extends AbstractOmemo
|
|||
}
|
||||
|
||||
@AfterClass
|
||||
public void cleanUp() {
|
||||
public void cleanUp() throws IOException {
|
||||
alice.stopStanzaAndPEPListeners();
|
||||
bob.stopStanzaAndPEPListeners();
|
||||
OmemoManagerSetupHelper.cleanUpPubSub(alice);
|
||||
|
|
|
@ -18,6 +18,7 @@ package org.jivesoftware.smackx.omemo;
|
|||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
|
||||
import org.jivesoftware.smack.SmackException;
|
||||
|
@ -50,7 +51,7 @@ public class OmemoMamDecryptionTest extends AbstractTwoUsersOmemoIntegrationTest
|
|||
@SmackIntegrationTest
|
||||
public void mamDecryptionTest() throws XMPPException.XMPPErrorException, SmackException.NotLoggedInException,
|
||||
SmackException.NotConnectedException, InterruptedException, SmackException.NoResponseException,
|
||||
CryptoFailedException, UndecidedOmemoIdentityException {
|
||||
CryptoFailedException, UndecidedOmemoIdentityException, IOException {
|
||||
// Make sure, Bobs server stores messages in the archive
|
||||
MamManager bobsMamManager = MamManager.getInstanceFor(bob.getConnection());
|
||||
bobsMamManager.enableMamForAllMessages();
|
||||
|
|
|
@ -20,6 +20,7 @@ import static org.junit.Assert.assertEquals;
|
|||
import static org.junit.Assert.assertFalse;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.HashMap;
|
||||
|
||||
import org.jivesoftware.smack.SmackException;
|
||||
|
@ -46,7 +47,7 @@ public class OmemoManagerSetupHelper {
|
|||
public static void trustAllIdentities(OmemoManager alice, OmemoManager bob)
|
||||
throws InterruptedException, SmackException.NotConnectedException, SmackException.NotLoggedInException,
|
||||
SmackException.NoResponseException, CannotEstablishOmemoSessionException, CorruptedOmemoKeyException,
|
||||
XMPPException.XMPPErrorException, PubSubException.NotALeafNodeException {
|
||||
XMPPException.XMPPErrorException, PubSubException.NotALeafNodeException, IOException {
|
||||
Roster roster = Roster.getInstanceFor(alice.getConnection());
|
||||
|
||||
if (alice.getOwnJid() != bob.getOwnJid() &&
|
||||
|
@ -66,7 +67,7 @@ public class OmemoManagerSetupHelper {
|
|||
public static void trustAllIdentitiesWithTests(OmemoManager alice, OmemoManager bob)
|
||||
throws InterruptedException, SmackException.NotConnectedException, SmackException.NotLoggedInException,
|
||||
SmackException.NoResponseException, CannotEstablishOmemoSessionException, CorruptedOmemoKeyException,
|
||||
XMPPException.XMPPErrorException, PubSubException.NotALeafNodeException {
|
||||
XMPPException.XMPPErrorException, PubSubException.NotALeafNodeException, IOException {
|
||||
alice.requestDeviceListUpdateFor(bob.getOwnJid());
|
||||
HashMap<OmemoDevice, OmemoFingerprint> fps1 = alice.getActiveFingerprints(bob.getOwnJid());
|
||||
|
||||
|
@ -124,7 +125,7 @@ public class OmemoManagerSetupHelper {
|
|||
}
|
||||
}
|
||||
|
||||
public static void cleanUpPubSub(OmemoManager omemoManager) {
|
||||
public static void cleanUpPubSub(OmemoManager omemoManager) throws IOException {
|
||||
PubSubManager pm = PubSubManager.getInstanceFor(omemoManager.getConnection(), omemoManager.getOwnJid());
|
||||
try {
|
||||
omemoManager.requestDeviceListUpdateFor(omemoManager.getOwnJid());
|
||||
|
|
|
@ -20,6 +20,8 @@ import static junit.framework.TestCase.assertEquals;
|
|||
import static junit.framework.TestCase.assertFalse;
|
||||
import static junit.framework.TestCase.assertTrue;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import org.jivesoftware.smack.SmackException;
|
||||
import org.jivesoftware.smack.XMPPException;
|
||||
import org.jivesoftware.smackx.omemo.exceptions.CryptoFailedException;
|
||||
|
@ -37,7 +39,9 @@ public class ReadOnlyDeviceIntegrationTest extends AbstractTwoUsersOmemoIntegrat
|
|||
}
|
||||
|
||||
@SmackIntegrationTest
|
||||
public void test() throws InterruptedException, SmackException.NoResponseException, SmackException.NotLoggedInException, SmackException.NotConnectedException, CryptoFailedException, UndecidedOmemoIdentityException {
|
||||
public void test() throws InterruptedException, SmackException.NoResponseException,
|
||||
SmackException.NotLoggedInException, SmackException.NotConnectedException, CryptoFailedException,
|
||||
UndecidedOmemoIdentityException, IOException {
|
||||
boolean prevIgnoreReadOnlyConf = OmemoConfiguration.getIgnoreReadOnlyDevices();
|
||||
int prevMaxMessageCounter = OmemoConfiguration.getMaxReadOnlyMessageCount();
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue