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 {
// Apply stringprep profiles to the "to" and "from" values.
String to = element.attributeValue("to");
if (to != null) {
String[] parts = JID.getParts(to);
toJID = new JID(parts[0], parts[1], parts[2], skipValidation);
element.addAttribute("to", toJID.toString());
if (to.length() == 0) {
// Remove empty TO values
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");
if (from != null) {
String[] parts = JID.getParts(from);
fromJID = new JID(parts[0], parts[1], parts[2], true);
element.addAttribute("from", fromJID.toString());
if (from.length() == 0) {
// Remove empty FROM values
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 {
*/
public JID getTo() {
String to = element.attributeValue("to");
if (to == null) {
if (to == null || to.length() == 0) {
return null;
}
else {
......@@ -179,7 +191,7 @@ public abstract class Packet {
*/
public JID getFrom() {
String from = element.attributeValue("from");
if (from == null) {
if (from == null || from.length() == 0) {
return null;
}
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