mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-12 18:59:06 +01:00
Argh, god damn it, removed Java 1.6 methods again.
This commit is contained in:
@@ -2,7 +2,7 @@ package org.briarproject.api;
|
||||
|
||||
import static org.briarproject.api.AuthorConstants.MAX_AUTHOR_NAME_LENGTH;
|
||||
|
||||
import java.nio.charset.Charset;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
|
||||
/** A pseudonym for a user. */
|
||||
public class Author {
|
||||
@@ -14,7 +14,12 @@ public class Author {
|
||||
private final byte[] publicKey;
|
||||
|
||||
public Author(AuthorId id, String name, byte[] publicKey) {
|
||||
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_AUTHOR_NAME_LENGTH)
|
||||
throw new IllegalArgumentException();
|
||||
this.id = id;
|
||||
|
||||
Reference in New Issue
Block a user