From fe03a22926eae540ae7caeae59fd1ecca32c9de9 Mon Sep 17 00:00:00 2001 From: Moxie Marlinspike Date: Mon, 17 Feb 2014 13:19:49 -0800 Subject: [PATCH] Make group creation exceptions more accurate. --- .../securesms/GroupCreateActivity.java | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/src/org/thoughtcrime/securesms/GroupCreateActivity.java b/src/org/thoughtcrime/securesms/GroupCreateActivity.java index 47ce656461..1304a7b8e8 100644 --- a/src/org/thoughtcrime/securesms/GroupCreateActivity.java +++ b/src/org/thoughtcrime/securesms/GroupCreateActivity.java @@ -357,13 +357,14 @@ public class GroupCreateActivity extends PassphraseRequiredSherlockFragmentActiv private long handleCreatePushGroup(String groupName, byte[] avatar, Set members) - throws IOException, InvalidNumberException + throws InvalidNumberException, MmsException { + GroupDatabase groupDatabase = DatabaseFactory.getGroupDatabase(this); + byte[] groupId = groupDatabase.allocateGroupId(); + try { - GroupDatabase groupDatabase = DatabaseFactory.getGroupDatabase(this); - List memberE164Numbers = getE164Numbers(members); - byte[] groupId = groupDatabase.allocateGroupId(); - String groupRecipientId = GroupUtil.getEncodedId(groupId); + List memberE164Numbers = getE164Numbers(members); + String groupRecipientId = GroupUtil.getEncodedId(groupId); String groupActionArguments = GroupUtil.serializeArguments(groupId, groupName, memberE164Numbers); @@ -377,9 +378,11 @@ public class GroupCreateActivity extends PassphraseRequiredSherlockFragmentActiv GroupContext.Type.CREATE_VALUE, groupActionArguments, avatar); } catch (RecipientFormattingException e) { - throw new IOException(e); + throw new AssertionError(e); } catch (MmsException e) { - throw new IOException(e); + Log.w("GroupCreateActivity", e); + groupDatabase.remove(groupId, TextSecurePreferences.getLocalNumber(this)); + throw new MmsException(e); } }