Make group creation exceptions more accurate.

This commit is contained in:
Moxie Marlinspike 2014-02-17 13:19:49 -08:00
parent d8e1df9233
commit fe03a22926

View File

@ -357,13 +357,14 @@ public class GroupCreateActivity extends PassphraseRequiredSherlockFragmentActiv
private long handleCreatePushGroup(String groupName, private long handleCreatePushGroup(String groupName,
byte[] avatar, byte[] avatar,
Set<Recipient> members) Set<Recipient> members)
throws IOException, InvalidNumberException throws InvalidNumberException, MmsException
{ {
GroupDatabase groupDatabase = DatabaseFactory.getGroupDatabase(this);
byte[] groupId = groupDatabase.allocateGroupId();
try { try {
GroupDatabase groupDatabase = DatabaseFactory.getGroupDatabase(this); List<String> memberE164Numbers = getE164Numbers(members);
List<String> memberE164Numbers = getE164Numbers(members); String groupRecipientId = GroupUtil.getEncodedId(groupId);
byte[] groupId = groupDatabase.allocateGroupId();
String groupRecipientId = GroupUtil.getEncodedId(groupId);
String groupActionArguments = GroupUtil.serializeArguments(groupId, groupName, memberE164Numbers); String groupActionArguments = GroupUtil.serializeArguments(groupId, groupName, memberE164Numbers);
@ -377,9 +378,11 @@ public class GroupCreateActivity extends PassphraseRequiredSherlockFragmentActiv
GroupContext.Type.CREATE_VALUE, GroupContext.Type.CREATE_VALUE,
groupActionArguments, avatar); groupActionArguments, avatar);
} catch (RecipientFormattingException e) { } catch (RecipientFormattingException e) {
throw new IOException(e); throw new AssertionError(e);
} catch (MmsException e) { } catch (MmsException e) {
throw new IOException(e); Log.w("GroupCreateActivity", e);
groupDatabase.remove(groupId, TextSecurePreferences.getLocalNumber(this));
throw new MmsException(e);
} }
} }