diff --git a/briar-android/src/org/briarproject/android/groups/CreateGroupActivity.java b/briar-android/src/org/briarproject/android/groups/CreateGroupActivity.java
index 5474b05a1951d8737edcb2bbf5c4b92e9169ddcb..b0aafeeec1d8022fe68dc5534eba814e51fef7d9 100644
--- a/briar-android/src/org/briarproject/android/groups/CreateGroupActivity.java
+++ b/briar-android/src/org/briarproject/android/groups/CreateGroupActivity.java
@@ -12,6 +12,7 @@ import static java.util.logging.Level.INFO;
 import static java.util.logging.Level.WARNING;
 import static org.briarproject.android.util.CommonLayoutParams.MATCH_MATCH;
 import static org.briarproject.android.util.CommonLayoutParams.WRAP_WRAP;
+import static org.briarproject.api.messaging.MessagingConstants.MAX_GROUP_NAME_LENGTH;
 
 import java.util.Collection;
 import java.util.Collections;
@@ -242,7 +243,8 @@ SelectContactsDialog.Listener {
 	}
 
 	private boolean validateName() {
-		if(nameEntry.getText().toString().equals("")) return false;
+		int length = nameEntry.getText().length();
+		if(length == 0 || length > MAX_GROUP_NAME_LENGTH) return false;
 		// Hide the soft keyboard
 		Object o = getSystemService(INPUT_METHOD_SERVICE);
 		((InputMethodManager) o).toggleSoftInput(HIDE_IMPLICIT_ONLY, 0);
diff --git a/briar-android/src/org/briarproject/android/identity/CreateIdentityActivity.java b/briar-android/src/org/briarproject/android/identity/CreateIdentityActivity.java
index e48cf9135505fa74c66c083da7dc02b309f891a3..117781b1a36fe614241ca7a484f4edde95cf0915 100644
--- a/briar-android/src/org/briarproject/android/identity/CreateIdentityActivity.java
+++ b/briar-android/src/org/briarproject/android/identity/CreateIdentityActivity.java
@@ -12,6 +12,7 @@ import static java.util.logging.Level.INFO;
 import static java.util.logging.Level.WARNING;
 import static org.briarproject.android.util.CommonLayoutParams.MATCH_MATCH;
 import static org.briarproject.android.util.CommonLayoutParams.WRAP_WRAP;
+import static org.briarproject.api.AuthorConstants.MAX_AUTHOR_NAME_LENGTH;
 
 import java.util.concurrent.Executor;
 import java.util.logging.Logger;
@@ -135,7 +136,8 @@ implements OnEditorActionListener, OnClickListener {
 	}
 
 	private boolean validateNickname() {
-		if(nicknameEntry.getText().toString().equals("")) return false;
+		int length = nicknameEntry.getText().length();
+		if(length == 0 || length > MAX_AUTHOR_NAME_LENGTH) return false;
 		// Hide the soft keyboard
 		Object o = getSystemService(INPUT_METHOD_SERVICE);
 		((InputMethodManager) o).toggleSoftInput(HIDE_IMPLICIT_ONLY, 0);
diff --git a/briar-api/src/org/briarproject/api/Author.java b/briar-api/src/org/briarproject/api/Author.java
index 7c313a8b4ebcd726dcff84c41d1482afe8ab3dee..abb66aaa3fe84490d19e29f9b62b5487850319ee 100644
--- a/briar-api/src/org/briarproject/api/Author.java
+++ b/briar-api/src/org/briarproject/api/Author.java
@@ -1,5 +1,7 @@
 package org.briarproject.api;
 
+import static org.briarproject.api.AuthorConstants.MAX_AUTHOR_NAME_LENGTH;
+
 /** A pseudonym for a user. */
 public class Author {
 
@@ -8,6 +10,8 @@ public class Author {
 	private final byte[] publicKey;
 
 	public Author(AuthorId id, String name, byte[] publicKey) {
+		if(name.length() == 0 || name.length() > MAX_AUTHOR_NAME_LENGTH)
+			throw new IllegalArgumentException();
 		this.id = id;
 		this.name = name;
 		this.publicKey = publicKey;
diff --git a/briar-api/src/org/briarproject/api/TransportId.java b/briar-api/src/org/briarproject/api/TransportId.java
index d99097a26399d2c7509414f23bf8565051a49e6a..e4a57a6d7c9546f36c99aff2ac6f4b1b7ee43cf5 100644
--- a/briar-api/src/org/briarproject/api/TransportId.java
+++ b/briar-api/src/org/briarproject/api/TransportId.java
@@ -10,7 +10,7 @@ public class TransportId {
 	private final String id;
 
 	public TransportId(String id) {
-		if(id.length() > MAX_TRANSPORT_ID_LENGTH || id.equals(""))
+		if(id.length() == 0 || id.length() > MAX_TRANSPORT_ID_LENGTH)
 			throw new IllegalArgumentException();
 		this.id = id;
 	}
diff --git a/briar-api/src/org/briarproject/api/messaging/Group.java b/briar-api/src/org/briarproject/api/messaging/Group.java
index e4efec0c1cf91b22b76bef5792654474adb63f55..882ebbd5ba5cc78cad592954bd1df3a51e7eaee3 100644
--- a/briar-api/src/org/briarproject/api/messaging/Group.java
+++ b/briar-api/src/org/briarproject/api/messaging/Group.java
@@ -1,5 +1,8 @@
 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;
+
 /** A group to which users may subscribe. */
 public class Group {
 
@@ -8,6 +11,10 @@ public class Group {
 	private final byte[] salt;
 
 	public Group(GroupId id, String name, byte[] salt) {
+		if(name.length() == 0 || name.length() > MAX_GROUP_NAME_LENGTH)
+			throw new IllegalArgumentException();
+		if(salt.length != GROUP_SALT_LENGTH)
+			throw new IllegalArgumentException();
 		this.id = id;
 		this.name = name;
 		this.salt = salt;
diff --git a/briar-core/src/org/briarproject/invitation/Connector.java b/briar-core/src/org/briarproject/invitation/Connector.java
index 2b766146bb03b4cbab91d1d089d01f2ba534e7ff..a8952c2987beeec614fbe2da007360c3bf81dfb8 100644
--- a/briar-core/src/org/briarproject/invitation/Connector.java
+++ b/briar-core/src/org/briarproject/invitation/Connector.java
@@ -249,7 +249,7 @@ abstract class Connector extends Thread {
 		r.readListStart();
 		while(!r.hasListEnd()) {
 			String idString = r.readString(MAX_TRANSPORT_ID_LENGTH);
-			if(idString.equals("")) throw new FormatException();
+			if(idString.length() == 0) throw new FormatException();
 			TransportId id = new TransportId(idString);
 			Map<String, String> p = new HashMap<String, String>();
 			r.readMapStart();
diff --git a/briar-core/src/org/briarproject/messaging/AuthorReader.java b/briar-core/src/org/briarproject/messaging/AuthorReader.java
index 7244fdf25d881619546d8588fcb1a49042c0b088..b30e10920cdc17bc3dc91a21325f9b1e43cc9767 100644
--- a/briar-core/src/org/briarproject/messaging/AuthorReader.java
+++ b/briar-core/src/org/briarproject/messaging/AuthorReader.java
@@ -8,6 +8,7 @@ import java.io.IOException;
 
 import org.briarproject.api.Author;
 import org.briarproject.api.AuthorId;
+import org.briarproject.api.FormatException;
 import org.briarproject.api.crypto.CryptoComponent;
 import org.briarproject.api.crypto.MessageDigest;
 import org.briarproject.api.serial.DigestingConsumer;
@@ -29,6 +30,7 @@ class AuthorReader implements StructReader<Author> {
 		// Read and digest the data
 		r.readStructStart(AUTHOR);
 		String name = r.readString(MAX_AUTHOR_NAME_LENGTH);
+		if(name.length() == 0) throw new FormatException();
 		byte[] publicKey = r.readBytes(MAX_PUBLIC_KEY_LENGTH);
 		r.readStructEnd();
 		// Reset the reader
diff --git a/briar-core/src/org/briarproject/messaging/PacketReaderImpl.java b/briar-core/src/org/briarproject/messaging/PacketReaderImpl.java
index ff8610b2754857d9e19fc644ed1e51da0c9e1fc8..b34244fd0f719fe7b8702077cf5e5923c7023979 100644
--- a/briar-core/src/org/briarproject/messaging/PacketReaderImpl.java
+++ b/briar-core/src/org/briarproject/messaging/PacketReaderImpl.java
@@ -213,7 +213,7 @@ class PacketReaderImpl implements PacketReader {
 	public TransportAck readTransportAck() throws IOException {
 		r.readStructStart(TRANSPORT_ACK);
 		String idString = r.readString(MAX_TRANSPORT_ID_LENGTH);
-		if(idString.equals("")) throw new FormatException();
+		if(idString.length() == 0) throw new FormatException();
 		TransportId id = new TransportId(idString);
 		long version = r.readInteger();
 		if(version < 0) throw new FormatException();
@@ -233,7 +233,7 @@ class PacketReaderImpl implements PacketReader {
 		r.readStructStart(TRANSPORT_UPDATE);
 		// Read the transport ID
 		String idString = r.readString(MAX_TRANSPORT_ID_LENGTH);
-		if(idString.equals("")) throw new FormatException();
+		if(idString.length() == 0) throw new FormatException();
 		TransportId id = new TransportId(idString);
 		// Read the transport properties
 		Map<String, String> p = new HashMap<String, String>();
diff --git a/briar-core/src/org/briarproject/util/StringUtils.java b/briar-core/src/org/briarproject/util/StringUtils.java
index c47bbe177a6b2a1b1e893cc378e57c602d1a3dda..db3f151e1d0b0cac039631453fe5aa0a194a86af 100644
--- a/briar-core/src/org/briarproject/util/StringUtils.java
+++ b/briar-core/src/org/briarproject/util/StringUtils.java
@@ -8,7 +8,7 @@ public class StringUtils {
 	};
 
 	public static boolean isNullOrEmpty(String s) {
-		return s == null || s.equals("");
+		return s == null || s.length() == 0;
 	}
 
 	/**
@@ -17,7 +17,7 @@ public class StringUtils {
 	 */
 	public static String head(String s, int length) {
 		if(s.length() > length) return s.substring(0, length) + "...";
-		else return s;
+		return s;
 	}
 
 	/**
@@ -26,7 +26,7 @@ public class StringUtils {
 	 */
 	public static String tail(String s, int length) {
 		if(s.length() > length) return "..." + s.substring(s.length() - length);
-		else return s;
+		return s;
 	}
 
 	/** Converts the given byte array to a hex character array. */