summaryrefslogtreecommitdiffstats
path: root/src/com
diff options
context:
space:
mode:
authorAlex Clayton <alex.clayton@isode.com>2016-03-21 15:41:42 (GMT)
committerAlex Clayton <alex.clayton@isode.com>2016-03-22 11:24:06 (GMT)
commit0ec7a2d8ab803b0e2df2c616f61d2b69b042561f (patch)
treec4c03f68cc001294a304ed23c923c6b8c37d0cb2 /src/com
parentaa5444b24c46f1e3a83682a59e71c780e2523160 (diff)
downloadstroke-0ec7a2d8ab803b0e2df2c616f61d2b69b042561f.zip
stroke-0ec7a2d8ab803b0e2df2c616f61d2b69b042561f.tar.bz2
Don't allow JIDs with explicitly empty resources
As per swiften patch of same name (6159c580884583bad0e17d4e96ea9ffc7e0be29a). A JID may have no resource, but may not have an empty resource. Mark such JIDs as invalid. Test-information: New unit test passes. Change-Id: I66ec7810ac29cb3963470b08f0d9f4901d2307f3
Diffstat (limited to 'src/com')
-rw-r--r--src/com/isode/stroke/jid/JID.java13
1 files changed, 8 insertions, 5 deletions
diff --git a/src/com/isode/stroke/jid/JID.java b/src/com/isode/stroke/jid/JID.java
index 59eef52..8b62ca1 100644
--- a/src/com/isode/stroke/jid/JID.java
+++ b/src/com/isode/stroke/jid/JID.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2010-2012, Isode Limited, London, England.
+ * Copyright (c) 2010-2016, Isode Limited, London, England.
* All rights reserved.
*/
/*
@@ -14,13 +14,13 @@
package com.isode.stroke.jid;
-import com.isode.stroke.idn.ICUConverter;
-import com.isode.stroke.idn.IDNConverter;
-import com.ibm.icu.text.StringPrepParseException;
-import com.isode.stroke.base.NotNull;
import java.util.Arrays;
import java.util.List;
+import com.isode.stroke.base.NotNull;
+import com.isode.stroke.idn.ICUConverter;
+import com.isode.stroke.idn.IDNConverter;
+
/**
* JID helper.
*
@@ -147,6 +147,9 @@ public class JID implements Comparable<JID> {
NotNull.exceptIfNull(domain, "domain");
valid_ = true;
hasResource_ = (resource != null);
+ if (hasResource_ && resource.isEmpty()) {
+ valid_ = false;
+ }
nameprepAndSetComponents(node, domain, resource);
}