aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/java/eu
diff options
context:
space:
mode:
authoriNPUTmice <daniel@gultsch.de>2015-02-26 16:56:07 +0100
committeriNPUTmice <daniel@gultsch.de>2015-02-26 16:56:07 +0100
commit9e10c3841e21e49db11a01e838753409ee01d5de (patch)
treee8bba2510f27acf0ce0f98f0228dc4853a27c83e /src/main/java/eu
parentfa45ceabc97cee3ec48fc1a726a4806884aeb747 (diff)
check for null in jid parser
Diffstat (limited to 'src/main/java/eu')
-rw-r--r--src/main/java/eu/siacs/conversations/xmpp/jid/InvalidJidException.java1
-rw-r--r--src/main/java/eu/siacs/conversations/xmpp/jid/Jid.java2
2 files changed, 3 insertions, 0 deletions
diff --git a/src/main/java/eu/siacs/conversations/xmpp/jid/InvalidJidException.java b/src/main/java/eu/siacs/conversations/xmpp/jid/InvalidJidException.java
index f1855263..164e8849 100644
--- a/src/main/java/eu/siacs/conversations/xmpp/jid/InvalidJidException.java
+++ b/src/main/java/eu/siacs/conversations/xmpp/jid/InvalidJidException.java
@@ -8,6 +8,7 @@ public class InvalidJidException extends Exception {
public final static String INVALID_PART_LENGTH = "JID part must be between 0 and 1023 characters";
public final static String INVALID_CHARACTER = "JID contains an invalid character";
public final static String STRINGPREP_FAIL = "The STRINGPREP operation has failed for the given JID";
+ public final static String IS_NULL = "JID can not be NULL";
/**
* Constructs a new {@code Exception} that includes the current stack trace.
diff --git a/src/main/java/eu/siacs/conversations/xmpp/jid/Jid.java b/src/main/java/eu/siacs/conversations/xmpp/jid/Jid.java
index a35ea37c..b8be527b 100644
--- a/src/main/java/eu/siacs/conversations/xmpp/jid/Jid.java
+++ b/src/main/java/eu/siacs/conversations/xmpp/jid/Jid.java
@@ -60,6 +60,8 @@ public final class Jid {
}
private Jid(final String jid) throws InvalidJidException {
+ if (jid == null) throw new InvalidJidException(InvalidJidException.IS_NULL);
+
// Hackish Android way to count the number of chars in a string... should work everywhere.
final int atCount = jid.length() - jid.replace("@", "").length();
final int slashCount = jid.length() - jid.replace("/", "").length();