From 67011fc32229a38e7aeb09a4b6e6a56dcfcfb55d Mon Sep 17 00:00:00 2001 From: Florian Schmaus Date: Wed, 3 Sep 2014 17:56:51 +0200 Subject: [PATCH] Remove xmlns field from Packet Stanzas do not have a xmlns attribute in their top level element. --- .../org/jivesoftware/smack/packet/Message.java | 1 - .../org/jivesoftware/smack/packet/Packet.java | 18 ++---------------- .../jivesoftware/smack/packet/Presence.java | 1 - 3 files changed, 2 insertions(+), 18 deletions(-) diff --git a/smack-core/src/main/java/org/jivesoftware/smack/packet/Message.java b/smack-core/src/main/java/org/jivesoftware/smack/packet/Message.java index ae1192a46..9bbfce8fa 100644 --- a/smack-core/src/main/java/org/jivesoftware/smack/packet/Message.java +++ b/smack-core/src/main/java/org/jivesoftware/smack/packet/Message.java @@ -416,7 +416,6 @@ public class Message extends Packet { public XmlStringBuilder toXML() { XmlStringBuilder buf = new XmlStringBuilder(); buf.halfOpenElement("message"); - buf.xmlnsAttribute(getXmlns()); buf.xmllangAttribute(getLanguage()); addCommonAttributes(buf); if (type != Type.normal) { diff --git a/smack-core/src/main/java/org/jivesoftware/smack/packet/Packet.java b/smack-core/src/main/java/org/jivesoftware/smack/packet/Packet.java index 663259a2d..782f7be8a 100644 --- a/smack-core/src/main/java/org/jivesoftware/smack/packet/Packet.java +++ b/smack-core/src/main/java/org/jivesoftware/smack/packet/Packet.java @@ -42,8 +42,6 @@ public abstract class Packet { protected static final String DEFAULT_LANGUAGE = java.util.Locale.getDefault().getLanguage().toLowerCase(Locale.US); - private static String DEFAULT_XML_NS = null; - /** * A prefix helps to make sure that ID's are unique across multiple instances. */ @@ -55,12 +53,6 @@ public abstract class Packet { */ private static AtomicLong id = new AtomicLong(); - private String xmlns = DEFAULT_XML_NS; - - public static void setDefaultXmlns(String defaultXmlns) { - DEFAULT_XML_NS = defaultXmlns; - } - private String packetID = null; private String to = null; private String from = null; @@ -81,7 +73,6 @@ public abstract class Packet { packetID = p.getPacketID(); to = p.getTo(); from = p.getFrom(); - xmlns = p.xmlns; error = p.error; // Copy extensions @@ -280,10 +271,6 @@ public abstract class Packet { return xml; } - public String getXmlns() { - return this.xmlns; - } - /** * Returns the default language used for all messages containing localized content. * @@ -307,13 +294,12 @@ public abstract class Packet { return false; } if (to != null ? !to.equals(packet.to) : packet.to != null) { return false; } - return !(xmlns != null ? !xmlns.equals(packet.xmlns) : packet.xmlns != null); + return true; } @Override public int hashCode() { - int result; - result = (xmlns != null ? xmlns.hashCode() : 0); + int result = 1; result = 31 * result + (packetID != null ? packetID.hashCode() : 0); result = 31 * result + (to != null ? to.hashCode() : 0); result = 31 * result + (from != null ? from.hashCode() : 0); diff --git a/smack-core/src/main/java/org/jivesoftware/smack/packet/Presence.java b/smack-core/src/main/java/org/jivesoftware/smack/packet/Presence.java index f76b1015f..a9df24971 100644 --- a/smack-core/src/main/java/org/jivesoftware/smack/packet/Presence.java +++ b/smack-core/src/main/java/org/jivesoftware/smack/packet/Presence.java @@ -228,7 +228,6 @@ public class Presence extends Packet { public XmlStringBuilder toXML() { XmlStringBuilder buf = new XmlStringBuilder(); buf.halfOpenElement(ELEMENT); - buf.xmlnsAttribute(getXmlns()); buf.xmllangAttribute(getLanguage()); addCommonAttributes(buf); if (type != Type.available) {