mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-14 03:39:05 +01:00
Let StringUtils throw FormatException instead of IllegalArgumentException
This commit is contained in:
@@ -8,6 +8,7 @@ import android.os.StrictMode;
|
||||
import com.vanniktech.emoji.RecentEmoji;
|
||||
|
||||
import org.briarproject.bramble.api.FeatureFlags;
|
||||
import org.briarproject.bramble.api.FormatException;
|
||||
import org.briarproject.bramble.api.crypto.CryptoComponent;
|
||||
import org.briarproject.bramble.api.crypto.KeyStrengthener;
|
||||
import org.briarproject.bramble.api.crypto.PublicKey;
|
||||
@@ -242,7 +243,7 @@ public class AppModule {
|
||||
try {
|
||||
return crypto.getMessageKeyParser().parsePublicKey(
|
||||
StringUtils.fromHexString(DEV_PUBLIC_KEY_HEX));
|
||||
} catch (GeneralSecurityException e) {
|
||||
} catch (GeneralSecurityException | FormatException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,6 +22,7 @@ import android.widget.Toast;
|
||||
import com.google.android.material.snackbar.Snackbar;
|
||||
|
||||
import org.briarproject.bramble.api.FeatureFlags;
|
||||
import org.briarproject.bramble.api.FormatException;
|
||||
import org.briarproject.bramble.api.Pair;
|
||||
import org.briarproject.bramble.api.connection.ConnectionRegistry;
|
||||
import org.briarproject.bramble.api.contact.ContactId;
|
||||
@@ -519,8 +520,12 @@ public class ConversationActivity extends BriarActivity
|
||||
Selection<String> selection = tracker.getSelection();
|
||||
List<MessageId> messages = new ArrayList<>(selection.size());
|
||||
for (String str : selection) {
|
||||
MessageId id = new MessageId(fromHexString(str));
|
||||
messages.add(id);
|
||||
try {
|
||||
MessageId id = new MessageId(fromHexString(str));
|
||||
messages.add(id);
|
||||
} catch (FormatException e) {
|
||||
LOG.warning("Invalid message id");
|
||||
}
|
||||
}
|
||||
return messages;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user