Skip to content

Instantly share code, notes, and snippets.

@jabocg
Last active April 22, 2016 00:15
Show Gist options
  • Save jabocg/95879edecbed596159fe78fcf8e39107 to your computer and use it in GitHub Desktop.
Save jabocg/95879edecbed596159fe78fcf8e39107 to your computer and use it in GitHub Desktop.
List<Contact> contacts = new Vector<Contact>();
SecureCommsGroup group;
try {
// add some members to a List
contacts.add(saife.getContactsByName("client1").get(0));
contacts.add(saife.getContactsByName("client2").get(0));
contacts.addAll(saife.getContactsByName("user"));
} catch (final NoSuchContactException nsce) {
final String m = imse.getMessage();
System.out.println(m);
} catch (final InvalidManagementStateException imse) {
final String m = imse.getMessage();
System.out.println(m);
}
try {
// creates a secure communications group
// members *MUST* be in an omnigroup together
group = saife.createGroup("group1", contacts);
} catch (final ContactGroupNotFoundException cgnfe) {
final String m = cgnfe.getMessage();
System.out.println(m);
} catch (final IllegalArgumentException iae) {
final String m = iae.getMessage();
System.out.println(m);
} catch (final IOException ioe) {
final String m = ioe.getMessage();
System.out.println(m);
} catch (final KeySizeNotSupportedException ksnse) {
final String m = ksnse.getMessage();
System.out.println(m);
} catch (final UnlockRequiredException ure) {
final String m = ure.getMessage();
System.out.println(m);
} catch (final Exception e) {
final String m = e.getMessage();
System.out.println(m);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment