Argh, god damn it, removed Java 1.6 methods again.

This commit is contained in:
akwizgran
2014-02-09 19:36:25 +00:00
parent ad38f63bf8
commit 0960a345e0
5 changed files with 27 additions and 11 deletions

View File

@@ -3,7 +3,7 @@ package org.briarproject.api.messaging;
import static org.briarproject.api.messaging.MessagingConstants.GROUP_SALT_LENGTH;
import static org.briarproject.api.messaging.MessagingConstants.MAX_GROUP_NAME_LENGTH;
import java.nio.charset.Charset;
import java.io.UnsupportedEncodingException;
/** A group to which users may subscribe. */
public class Group {
@@ -13,7 +13,12 @@ public class Group {
private final byte[] salt;
public Group(GroupId id, String name, byte[] salt) {
int length = name.getBytes(Charset.forName("UTF-8")).length;
int length;
try {
length = name.getBytes("UTF-8").length;
} catch(UnsupportedEncodingException e) {
throw new RuntimeException(e);
}
if(length == 0 || length > MAX_GROUP_NAME_LENGTH)
throw new IllegalArgumentException();
if(salt.length != GROUP_SALT_LENGTH)