Commit 97a137b7 authored by Gaston Dombiak's avatar Gaston Dombiak Committed by gato

Be more permissive. Accept TO and FROM with empty strings.

git-svn-id: http://svn.igniterealtime.org/svn/repos/openfire/trunk@8525 b35dd754-fafc-0310-a699-88a17e54d16e
parent c4f0c023
...@@ -69,15 +69,27 @@ public abstract class Packet { ...@@ -69,15 +69,27 @@ public abstract class Packet {
// Apply stringprep profiles to the "to" and "from" values. // Apply stringprep profiles to the "to" and "from" values.
String to = element.attributeValue("to"); String to = element.attributeValue("to");
if (to != null) { if (to != null) {
String[] parts = JID.getParts(to); if (to.length() == 0) {
toJID = new JID(parts[0], parts[1], parts[2], skipValidation); // Remove empty TO values
element.addAttribute("to", toJID.toString()); element.addAttribute("to", null);
}
else {
String[] parts = JID.getParts(to);
toJID = new JID(parts[0], parts[1], parts[2], skipValidation);
element.addAttribute("to", toJID.toString());
}
} }
String from = element.attributeValue("from"); String from = element.attributeValue("from");
if (from != null) { if (from != null) {
String[] parts = JID.getParts(from); if (from.length() == 0) {
fromJID = new JID(parts[0], parts[1], parts[2], true); // Remove empty FROM values
element.addAttribute("from", fromJID.toString()); element.addAttribute("from", null);
}
else {
String[] parts = JID.getParts(from);
fromJID = new JID(parts[0], parts[1], parts[2], true);
element.addAttribute("from", fromJID.toString());
}
} }
} }
...@@ -119,7 +131,7 @@ public abstract class Packet { ...@@ -119,7 +131,7 @@ public abstract class Packet {
*/ */
public JID getTo() { public JID getTo() {
String to = element.attributeValue("to"); String to = element.attributeValue("to");
if (to == null) { if (to == null || to.length() == 0) {
return null; return null;
} }
else { else {
...@@ -179,7 +191,7 @@ public abstract class Packet { ...@@ -179,7 +191,7 @@ public abstract class Packet {
*/ */
public JID getFrom() { public JID getFrom() {
String from = element.attributeValue("from"); String from = element.attributeValue("from");
if (from == null) { if (from == null || from.length() == 0) {
return null; return null;
} }
else { else {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment