From fee3ed81ca9c1219ec3925b45a5e880d074c556e Mon Sep 17 00:00:00 2001 From: Florian Schmaus Date: Mon, 4 Feb 2019 13:27:41 +0100 Subject: [PATCH] Introduce XmlEnvironment --- .../smack/compress/packet/Compress.java | 4 +- .../smack/compress/packet/Compressed.java | 2 +- .../smack/compress/packet/Failure.java | 2 +- .../smack/debugger/AbstractDebugger.java | 2 +- .../smack/packet/AbstractError.java | 2 +- .../smack/packet/AbstractTextElement.java | 2 +- .../org/jivesoftware/smack/packet/Bind.java | 2 +- .../smack/packet/DefaultExtensionElement.java | 2 +- .../jivesoftware/smack/packet/Element.java | 13 +- .../org/jivesoftware/smack/packet/IQ.java | 19 ++- .../jivesoftware/smack/packet/Mechanisms.java | 2 +- .../jivesoftware/smack/packet/Message.java | 18 +-- .../jivesoftware/smack/packet/Presence.java | 2 +- .../jivesoftware/smack/packet/Session.java | 2 +- .../packet/StandardExtensionElement.java | 2 +- .../org/jivesoftware/smack/packet/Stanza.java | 31 ++-- .../smack/packet/StanzaError.java | 13 +- .../jivesoftware/smack/packet/StartTls.java | 2 +- .../smack/packet/StreamClose.java | 2 +- .../smack/packet/StreamError.java | 4 +- .../jivesoftware/smack/packet/StreamOpen.java | 10 +- .../jivesoftware/smack/packet/TlsFailure.java | 2 +- .../jivesoftware/smack/packet/TlsProceed.java | 2 +- .../smack/packet/XmlEnvironment.java | 134 ++++++++++++++++++ .../smack/sasl/packet/SaslStreamElements.java | 12 +- .../smack/util/XmlStringBuilder.java | 45 +++--- .../smack/StanzaCollectorTest.java | 4 +- .../smack/compress/packet/FailureTest.java | 4 +- .../smack/packet/IQResponseTest.java | 2 +- .../smack/packet/XmlEnvironmentTest.java | 44 ++++++ .../StandardExtensionElementParserTest.java | 6 +- .../smack/util/PacketParserUtilsTest.java | 26 ++-- .../debugger/slf4j/SLF4JSmackDebugger.java | 4 +- .../smackx/debugger/EnhancedDebugger.java | 10 +- .../smackx/debugger/LiteDebugger.java | 4 +- .../carbons/packet/CarbonExtension.java | 6 +- .../element/ChatMarkersElements.java | 4 +- .../csi/packet/ClientStateIndication.java | 6 +- .../ExplicitMessageEncryptionElement.java | 2 +- .../smackx/hashes/element/HashElement.java | 4 +- .../smackx/hints/element/NoCopyHint.java | 2 +- .../hints/element/NoPermanentStoreHint.java | 2 +- .../smackx/hints/element/NoStoreHint.java | 2 +- .../smackx/hints/element/StoreHint.java | 2 +- .../hoxt/packet/AbstractHttpOverXmpp.java | 12 +- .../smackx/hoxt/packet/Base64BinaryChunk.java | 2 +- .../element/FileTooLargeError.java | 2 +- .../smackx/iot/control/element/SetData.java | 2 +- .../smackx/iot/data/element/IoTDataField.java | 2 +- .../iot/data/element/IoTFieldsExtension.java | 2 +- .../smackx/iot/data/element/NodeElement.java | 2 +- .../iot/data/element/TimestampElement.java | 2 +- .../smackx/iot/discovery/element/Tag.java | 2 +- .../iot/provisioning/element/Friend.java | 2 +- .../iot/provisioning/element/Unfriend.java | 2 +- .../jingle_filetransfer/element/Checksum.java | 2 +- .../element/JingleFileTransferChild.java | 2 +- .../jingle_filetransfer/element/Range.java | 4 +- .../packet/AbstractJsonPacketExtension.java | 2 +- .../smackx/mam/element/MamElements.java | 6 +- .../element/BlockQuoteElement.java | 2 +- .../element/CodeBlockElement.java | 2 +- .../message_markup/element/ListElement.java | 6 +- .../message_markup/element/MarkupElement.java | 4 +- .../message_markup/element/SpanElement.java | 2 +- .../muclight/element/MUCLightElements.java | 12 +- .../element/PushNotificationsElements.java | 2 +- .../reference/element/ReferenceElement.java | 4 +- .../smackx/sid/element/OriginIdElement.java | 2 +- .../smackx/sid/element/StanzaIdElement.java | 2 +- .../spoiler/element/SpoilerElement.java | 2 +- .../chat_markers/MarkableExtensionTest.java | 6 +- .../smackx/hashes/HashElementTest.java | 4 +- .../FileTooLargeErrorCreateTest.java | 2 +- .../jivesoftware/smackx/mam/FiltersTest.java | 6 +- .../smackx/mam/RetrieveFormFieldsTest.java | 2 +- .../message_markup/MessageMarkupTest.java | 14 +- ...ightConfigurationsChangeExtensionTest.java | 6 +- .../smackx/reference/ReferenceTest.java | 8 +- .../smackx/sid/StableUniqueStanzaIdTest.java | 4 +- .../smackx/spoiler/SpoilerTest.java | 12 +- .../address/MultipleRecipientManager.java | 10 +- .../address/packet/MultipleAddresses.java | 6 +- .../smackx/amp/packet/AMPExtension.java | 2 +- .../attention/packet/AttentionExtension.java | 2 +- .../element/BlockedErrorExtension.java | 2 +- .../smackx/bob/element/BoBExtension.java | 2 +- .../ibb/packet/DataPacketExtension.java | 2 +- .../bytestreams/socks5/packet/Bytestream.java | 12 +- .../cache/SimpleDirectoryPersistentCache.java | 2 +- .../smackx/caps/packet/CapsExtension.java | 2 +- .../chatstates/packet/ChatStateExtension.java | 2 +- .../commands/packet/AdHocCommandData.java | 4 +- .../smackx/delay/packet/DelayInformation.java | 2 +- .../smackx/forward/packet/Forwarded.java | 2 +- .../smackx/geoloc/packet/GeoLocation.java | 2 +- .../iqregister/packet/Registration.java | 2 +- .../smackx/jingle/element/JingleContent.java | 2 +- .../element/JingleContentDescription.java | 2 +- .../element/JingleContentTransport.java | 2 +- .../smackx/jingle/element/JingleError.java | 2 +- .../smackx/jingle/element/JingleReason.java | 4 +- .../UnknownJingleContentDescription.java | 7 +- .../UnknownJingleContentTransport.java | 7 +- .../element/JingleIBBTransport.java | 2 +- .../elements/JingleS5BTransportCandidate.java | 2 +- .../elements/JingleS5BTransportInfo.java | 14 +- .../packet/JivePropertiesExtension.java | 2 +- .../last_interaction/element/IdleElement.java | 2 +- .../element/MessageCorrectExtension.java | 2 +- .../mood/element/MoodConcretisation.java | 2 +- .../smackx/mood/element/MoodElement.java | 6 +- .../smackx/muc/MultiUserChatManager.java | 2 +- .../org/jivesoftware/smackx/muc/RoomInfo.java | 2 +- .../smackx/muc/packet/Destroy.java | 2 +- .../muc/packet/GroupChatInvitation.java | 2 +- .../smackx/muc/packet/MUCAdmin.java | 2 +- .../smackx/muc/packet/MUCInitialPresence.java | 4 +- .../smackx/muc/packet/MUCItem.java | 2 +- .../smackx/muc/packet/MUCOwner.java | 2 +- .../smackx/muc/packet/MUCUser.java | 8 +- .../jivesoftware/smackx/nick/packet/Nick.java | 2 +- .../offline/packet/OfflineMessageInfo.java | 2 +- .../smackx/pubsub/Affiliation.java | 2 +- .../smackx/pubsub/AffiliationsExtension.java | 2 +- .../smackx/pubsub/EventElement.java | 4 +- .../jivesoftware/smackx/pubsub/FormNode.java | 4 +- .../smackx/pubsub/GetItemsRequest.java | 2 +- .../org/jivesoftware/smackx/pubsub/Item.java | 4 +- .../smackx/pubsub/ItemsExtension.java | 6 +- .../smackx/pubsub/NodeExtension.java | 4 +- .../smackx/pubsub/OptionsExtension.java | 2 +- .../smackx/pubsub/PayloadItem.java | 6 +- .../smackx/pubsub/PublishItem.java | 4 +- .../smackx/pubsub/RetractItem.java | 2 +- .../smackx/pubsub/SimplePayload.java | 4 +- .../smackx/pubsub/SubscribeExtension.java | 2 +- .../smackx/pubsub/Subscription.java | 2 +- .../smackx/pubsub/SubscriptionsExtension.java | 4 +- .../smackx/pubsub/UnsubscribeExtension.java | 2 +- .../smackx/receipts/DeliveryReceipt.java | 2 +- .../receipts/DeliveryReceiptRequest.java | 2 +- .../smackx/rsm/packet/RSMSet.java | 2 +- .../smackx/shim/packet/Header.java | 2 +- .../smackx/shim/packet/HeadersExtension.java | 2 +- .../smackx/si/packet/StreamInitiation.java | 10 +- .../jivesoftware/smackx/xdata/FormField.java | 11 +- .../smackx/xdata/packet/DataForm.java | 10 +- .../smackx/xdatalayout/packet/DataLayout.java | 12 +- .../packet/ValidateElement.java | 4 +- .../smackx/xhtmlim/packet/XHTMLExtension.java | 2 +- .../smackx/amp/AMPExtensionTest.java | 2 +- .../smackx/blocking/BlockContactsIQTest.java | 2 +- .../ibb/packet/DataPacketExtensionTest.java | 2 +- .../smackx/caps/EntityCapsManagerTest.java | 2 +- .../FileTransferNegotiatorTest.java | 2 +- .../smackx/geoloc/packet/GeoLocationTest.java | 4 +- .../smackx/jingle/JingleContentTest.java | 6 +- .../smackx/jingle/JingleErrorTest.java | 8 +- .../smackx/jingle/JingleReasonTest.java | 34 ++--- .../smackx/jingle/JingleTest.java | 2 +- .../jingle_ibb/JingleIBBTransportTest.java | 4 +- .../jingle_s5b/JingleS5BTransportTest.java | 12 +- .../smackx/last_interaction/IdleTest.java | 2 +- .../MessageCorrectExtensionTest.java | 4 +- .../smackx/mood/MoodConcretisationTest.java | 4 +- .../smackx/mood/MoodElementTest.java | 6 +- .../pubsub/AffiliationsExtensionTest.java | 2 +- .../smackx/pubsub/ItemValidationTest.java | 24 ++-- .../smackx/pubsub/PubSubNodeTest.java | 2 +- .../smackx/pubsub/SimplePayloadTest.java | 2 +- .../smackx/xdata/packet/DataFormTest.java | 24 ++-- .../xdatalayout/packet/DataLayoutTest.java | 20 +-- .../provider/DataValidationTest.java | 24 ++-- .../java/org/jivesoftware/util/Protocol.java | 4 +- .../jivesoftware/smack/chat/ChatManager.java | 2 +- .../smack/roster/packet/RosterPacket.java | 4 +- .../smack/roster/packet/RosterVer.java | 2 +- .../packet/SubscriptionPreApproval.java | 2 +- .../rosterstore/DirectoryRosterStore.java | 2 +- .../smackx/caps/EntityCapsTest.java | 2 +- .../smackx/jingleold/JingleSession.java | 12 +- .../smackx/jingleold/packet/Jingle.java | 4 +- .../jingleold/packet/JingleContent.java | 6 +- .../packet/JingleContentDescription.java | 2 +- .../jingleold/packet/JingleContentInfo.java | 2 +- .../jingleold/packet/JingleDescription.java | 2 +- .../smackx/jingleold/packet/JingleError.java | 2 +- .../jingleold/packet/JingleTransport.java | 2 +- .../smackx/workgroup/MetaData.java | 2 +- .../smackx/workgroup/agent/AgentRoster.java | 2 +- .../smackx/workgroup/packet/AgentStatus.java | 2 +- .../workgroup/packet/OfferRevokeProvider.java | 4 +- .../smackx/workgroup/packet/QueueDetails.java | 2 +- .../workgroup/packet/QueueOverview.java | 3 +- .../smackx/workgroup/packet/QueueUpdate.java | 2 +- .../workgroup/packet/RoomInvitation.java | 2 +- .../smackx/workgroup/packet/RoomTransfer.java | 2 +- .../smackx/workgroup/packet/SessionID.java | 2 +- .../smackx/workgroup/packet/Transcript.java | 2 +- .../smackx/workgroup/packet/UserID.java | 2 +- .../packet/WorkgroupInformation.java | 2 +- .../smackx/workgroup/user/Workgroup.java | 4 +- .../smackx/xevent/packet/MessageEvent.java | 2 +- .../smackx/xroster/packet/RosterExchange.java | 2 +- .../omemo/element/OmemoBundleElement.java | 6 +- .../omemo/element/OmemoDeviceListElement.java | 2 +- .../smackx/omemo/element/OmemoElement.java | 2 +- .../omemo/element/OmemoHeaderElement.java | 2 +- .../smackx/omemo/element/OmemoKeyElement.java | 2 +- .../omemo/OmemoBundleVAxolotlElementTest.java | 2 +- .../OmemoDeviceListVAxolotlElementTest.java | 2 +- .../omemo/OmemoVAxolotlElementTest.java | 6 +- .../smackx/ox/element/CryptElement.java | 2 +- .../ox/element/OpenPgpContentElement.java | 2 +- .../smackx/ox/element/OpenPgpElement.java | 2 +- .../smackx/ox/element/PubkeyElement.java | 4 +- .../ox/element/PublicKeysListElement.java | 4 +- .../smackx/ox/element/SecretkeyElement.java | 2 +- .../smackx/ox/element/SignElement.java | 2 +- .../smackx/ox/element/SigncryptElement.java | 2 +- .../smackx/ox/OpenPgpElementTest.java | 8 +- .../smackx/ox/PubkeyElementTest.java | 2 +- .../smackx/ox/PublicKeysListElementTest.java | 2 +- .../smackx/ox/SecretkeyElementTest.java | 2 +- .../igniterealtime/smack/smackrepl/IoT.java | 2 +- .../smack/sm/packet/StreamManagement.java | 14 +- .../smack/tcp/XMPPTCPConnection.java | 4 +- .../provider/ParseStreamManagementTest.java | 4 +- 229 files changed, 715 insertions(+), 526 deletions(-) create mode 100644 smack-core/src/main/java/org/jivesoftware/smack/packet/XmlEnvironment.java create mode 100644 smack-core/src/test/java/org/jivesoftware/smack/packet/XmlEnvironmentTest.java diff --git a/smack-core/src/main/java/org/jivesoftware/smack/compress/packet/Compress.java b/smack-core/src/main/java/org/jivesoftware/smack/compress/packet/Compress.java index 91d96e6de..a3ba65245 100644 --- a/smack-core/src/main/java/org/jivesoftware/smack/compress/packet/Compress.java +++ b/smack-core/src/main/java/org/jivesoftware/smack/compress/packet/Compress.java @@ -45,7 +45,7 @@ public class Compress implements Nonza { } @Override - public XmlStringBuilder toXML(String enclosingNamespace) { + public XmlStringBuilder toXML(org.jivesoftware.smack.packet.XmlEnvironment enclosingNamespace) { XmlStringBuilder xml = new XmlStringBuilder(this, enclosingNamespace); xml.rightAngleBracket(); xml.element("method", method); @@ -77,7 +77,7 @@ public class Compress implements Nonza { } @Override - public XmlStringBuilder toXML(String enclosingNamespace) { + public XmlStringBuilder toXML(org.jivesoftware.smack.packet.XmlEnvironment enclosingNamespace) { XmlStringBuilder xml = new XmlStringBuilder(this); xml.rightAngleBracket(); for (String method : methods) { diff --git a/smack-core/src/main/java/org/jivesoftware/smack/compress/packet/Compressed.java b/smack-core/src/main/java/org/jivesoftware/smack/compress/packet/Compressed.java index 7075525a5..22026a161 100644 --- a/smack-core/src/main/java/org/jivesoftware/smack/compress/packet/Compressed.java +++ b/smack-core/src/main/java/org/jivesoftware/smack/compress/packet/Compressed.java @@ -39,7 +39,7 @@ public final class Compressed implements Nonza { } @Override - public String toXML(String enclosingNamespace) { + public String toXML(org.jivesoftware.smack.packet.XmlEnvironment enclosingNamespace) { return '<' + ELEMENT + " xmlns='" + NAMESPACE + "'/>"; } } diff --git a/smack-core/src/main/java/org/jivesoftware/smack/compress/packet/Failure.java b/smack-core/src/main/java/org/jivesoftware/smack/compress/packet/Failure.java index 8d52752a3..473abaccf 100644 --- a/smack-core/src/main/java/org/jivesoftware/smack/compress/packet/Failure.java +++ b/smack-core/src/main/java/org/jivesoftware/smack/compress/packet/Failure.java @@ -76,7 +76,7 @@ public class Failure implements Nonza { } @Override - public XmlStringBuilder toXML(String enclosingNamespace) { + public XmlStringBuilder toXML(org.jivesoftware.smack.packet.XmlEnvironment enclosingNamespace) { XmlStringBuilder xml = new XmlStringBuilder(this, enclosingNamespace); xml.rightAngleBracket(); diff --git a/smack-core/src/main/java/org/jivesoftware/smack/debugger/AbstractDebugger.java b/smack-core/src/main/java/org/jivesoftware/smack/debugger/AbstractDebugger.java index e1fc4f2a0..ad252e86c 100644 --- a/smack-core/src/main/java/org/jivesoftware/smack/debugger/AbstractDebugger.java +++ b/smack-core/src/main/java/org/jivesoftware/smack/debugger/AbstractDebugger.java @@ -161,7 +161,7 @@ public abstract class AbstractDebugger extends SmackDebugger { @Override public void onIncomingStreamElement(TopLevelStreamElement streamElement) { if (printInterpreted) { - log("RCV PKT (" + connection.getConnectionCounter() + "): " + streamElement.toXML(null)); + log("RCV PKT (" + connection.getConnectionCounter() + "): " + streamElement.toXML()); } } diff --git a/smack-core/src/main/java/org/jivesoftware/smack/packet/AbstractError.java b/smack-core/src/main/java/org/jivesoftware/smack/packet/AbstractError.java index 513c4ca83..ece30af7b 100644 --- a/smack-core/src/main/java/org/jivesoftware/smack/packet/AbstractError.java +++ b/smack-core/src/main/java/org/jivesoftware/smack/packet/AbstractError.java @@ -114,7 +114,7 @@ public class AbstractError { xml.closeElement("text"); } for (ExtensionElement packetExtension : extensions) { - xml.append(packetExtension.toXML(null)); + xml.append(packetExtension.toXML()); } } diff --git a/smack-core/src/main/java/org/jivesoftware/smack/packet/AbstractTextElement.java b/smack-core/src/main/java/org/jivesoftware/smack/packet/AbstractTextElement.java index 8b7bf750b..b60f66e40 100644 --- a/smack-core/src/main/java/org/jivesoftware/smack/packet/AbstractTextElement.java +++ b/smack-core/src/main/java/org/jivesoftware/smack/packet/AbstractTextElement.java @@ -37,7 +37,7 @@ public abstract class AbstractTextElement implements ExtensionElement { } @Override - public XmlStringBuilder toXML(String enclosingNamespace) { + public XmlStringBuilder toXML(org.jivesoftware.smack.packet.XmlEnvironment enclosingNamespace) { XmlStringBuilder xml = new XmlStringBuilder(this); xml.optXmlLangAttribute(lang); xml.rightAngleBracket(); diff --git a/smack-core/src/main/java/org/jivesoftware/smack/packet/Bind.java b/smack-core/src/main/java/org/jivesoftware/smack/packet/Bind.java index a8095a877..f64a29f65 100644 --- a/smack-core/src/main/java/org/jivesoftware/smack/packet/Bind.java +++ b/smack-core/src/main/java/org/jivesoftware/smack/packet/Bind.java @@ -89,7 +89,7 @@ public final class Bind extends IQ { } @Override - public String toXML(String enclosingNamespace) { + public String toXML(org.jivesoftware.smack.packet.XmlEnvironment enclosingNamespace) { return '<' + ELEMENT + " xmlns='" + NAMESPACE + "'/>"; } diff --git a/smack-core/src/main/java/org/jivesoftware/smack/packet/DefaultExtensionElement.java b/smack-core/src/main/java/org/jivesoftware/smack/packet/DefaultExtensionElement.java index 708c0407b..d01d9cdb6 100644 --- a/smack-core/src/main/java/org/jivesoftware/smack/packet/DefaultExtensionElement.java +++ b/smack-core/src/main/java/org/jivesoftware/smack/packet/DefaultExtensionElement.java @@ -86,7 +86,7 @@ public class DefaultExtensionElement implements ExtensionElement { } @Override - public CharSequence toXML(String enclosingNamespace) { + public CharSequence toXML(org.jivesoftware.smack.packet.XmlEnvironment enclosingNamespace) { XmlStringBuilder buf = new XmlStringBuilder(); buf.halfOpenElement(elementName).xmlnsAttribute(namespace).rightAngleBracket(); for (String name : getNames()) { diff --git a/smack-core/src/main/java/org/jivesoftware/smack/packet/Element.java b/smack-core/src/main/java/org/jivesoftware/smack/packet/Element.java index 06ad12fbc..0cfc582b3 100644 --- a/smack-core/src/main/java/org/jivesoftware/smack/packet/Element.java +++ b/smack-core/src/main/java/org/jivesoftware/smack/packet/Element.java @@ -1,6 +1,6 @@ /** * - * Copyright © 2014-2018 Florian Schmaus + * Copyright © 2014-2019 Florian Schmaus * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -23,7 +23,7 @@ package org.jivesoftware.smack.packet; */ public interface Element { - // TODO: Add a toXML() non-parameter default method once Smack supports Java 8. + CharSequence toXML(XmlEnvironment xmlEnvironment); /** * Returns the XML representation of this Element. This method takes an optional argument for the enclosing @@ -32,5 +32,12 @@ public interface Element { * @param enclosingNamespace the enclosing namespace or {@code null}. * @return the stanza extension as XML. */ - CharSequence toXML(String enclosingNamespace); + default CharSequence toXML(String enclosingNamespace) { + XmlEnvironment xmlEnvironment = new XmlEnvironment(enclosingNamespace); + return toXML(xmlEnvironment); + } + + default CharSequence toXML() { + return toXML(XmlEnvironment.EMPTY); + } } diff --git a/smack-core/src/main/java/org/jivesoftware/smack/packet/IQ.java b/smack-core/src/main/java/org/jivesoftware/smack/packet/IQ.java index 09fa9178e..3626b9b9b 100644 --- a/smack-core/src/main/java/org/jivesoftware/smack/packet/IQ.java +++ b/smack-core/src/main/java/org/jivesoftware/smack/packet/IQ.java @@ -126,10 +126,10 @@ public abstract class IQ extends Stanza { } @Override - public final XmlStringBuilder toXML(String enclosingNamespace) { - XmlStringBuilder buf = new XmlStringBuilder(enclosingNamespace); + public final XmlStringBuilder toXML(XmlEnvironment enclosingXmlEnvironment) { + XmlStringBuilder buf = new XmlStringBuilder(enclosingXmlEnvironment); buf.halfOpenElement(IQ_ELEMENT); - addCommonAttributes(buf, enclosingNamespace); + addCommonAttributes(buf, enclosingXmlEnvironment); if (type == null) { buf.attribute("type", "get"); } @@ -137,7 +137,7 @@ public abstract class IQ extends Stanza { buf.attribute("type", type.toString()); } buf.rightAngleBracket(); - buf.append(getChildElementXML(enclosingNamespace)); + buf.append(getChildElementXML(enclosingXmlEnvironment)); buf.closeElement(IQ_ELEMENT); return buf; } @@ -156,15 +156,15 @@ public abstract class IQ extends Stanza { * Returns the sub-element XML section of the IQ packet, or the empty String if there * isn't one. * - * @param enclosingNamespace the enclosing XML namespace. + * @param enclosingXmlEnvironment the enclosing XML namespace. * @return the child element section of the IQ XML. * @since 4.3.0 */ - public final XmlStringBuilder getChildElementXML(String enclosingNamespace) { + public final XmlStringBuilder getChildElementXML(XmlEnvironment enclosingXmlEnvironment) { XmlStringBuilder xml = new XmlStringBuilder(); if (type == Type.error) { // Add the error sub-packet, if there is one. - appendErrorIfExists(xml, enclosingNamespace); + appendErrorIfExists(xml, enclosingXmlEnvironment); } else if (childElementName != null) { // Add the query section if there is one. @@ -240,7 +240,7 @@ public abstract class IQ extends Stanza { protected final void initializeAsResultFor(IQ request) { if (!(request.getType() == Type.get || request.getType() == Type.set)) { throw new IllegalArgumentException( - "IQ must be of type 'set' or 'get'. Original IQ: " + request.toXML(null)); + "IQ must be of type 'set' or 'get'. Original IQ: " + request.toXML()); } setStanzaId(request.getStanzaId()); setFrom(request.getTo()); @@ -289,7 +289,7 @@ public abstract class IQ extends Stanza { public static ErrorIQ createErrorResponse(final IQ request, final StanzaError.Builder error) { if (!(request.getType() == Type.get || request.getType() == Type.set)) { throw new IllegalArgumentException( - "IQ must be of type 'set' or 'get'. Original IQ: " + request.toXML(null)); + "IQ must be of type 'set' or 'get'. Original IQ: " + request.toXML()); } final ErrorIQ result = new ErrorIQ(error); result.setStanzaId(request.getStanzaId()); @@ -381,7 +381,6 @@ public abstract class IQ extends Stanza { } private IQChildElementXmlStringBuilder(String element, String namespace) { - super(""); prelude(element, namespace); this.element = element; } diff --git a/smack-core/src/main/java/org/jivesoftware/smack/packet/Mechanisms.java b/smack-core/src/main/java/org/jivesoftware/smack/packet/Mechanisms.java index 0c8b58449..4ef0bcd66 100644 --- a/smack-core/src/main/java/org/jivesoftware/smack/packet/Mechanisms.java +++ b/smack-core/src/main/java/org/jivesoftware/smack/packet/Mechanisms.java @@ -53,7 +53,7 @@ public class Mechanisms implements ExtensionElement { } @Override - public XmlStringBuilder toXML(String enclosingNamespace) { + public XmlStringBuilder toXML(org.jivesoftware.smack.packet.XmlEnvironment enclosingNamespace) { XmlStringBuilder xml = new XmlStringBuilder(this); xml.rightAngleBracket(); for (String mechanism : mechanisms) { 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 ee22034c5..fe29d4c3d 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 @@ -479,10 +479,10 @@ public final class Message extends Stanza implements TypedCloneable { } @Override - public XmlStringBuilder toXML(String enclosingNamespace) { - XmlStringBuilder buf = new XmlStringBuilder(enclosingNamespace); + public XmlStringBuilder toXML(XmlEnvironment enclosingXmlEnvironment) { + XmlStringBuilder buf = new XmlStringBuilder(enclosingXmlEnvironment); buf.halfOpenElement(ELEMENT); - enclosingNamespace = addCommonAttributes(buf, enclosingNamespace); + enclosingXmlEnvironment = addCommonAttributes(buf, enclosingXmlEnvironment); buf.optAttribute("type", type); buf.rightAngleBracket(); @@ -496,16 +496,16 @@ public final class Message extends Stanza implements TypedCloneable { // Skip the default language if (subject.equals(defaultSubject)) continue; - buf.append(subject.toXML(null)); + buf.append(subject.toXML()); } buf.optElement("thread", thread); // Append the error subpacket if the message type is an error. if (type == Type.error) { - appendErrorIfExists(buf, enclosingNamespace); + appendErrorIfExists(buf, enclosingXmlEnvironment); } // Add extension elements, if any are defined. - buf.append(getExtensions(), enclosingNamespace); + buf.append(getExtensions(), enclosingXmlEnvironment); buf.closeElement(ELEMENT); return buf; @@ -600,7 +600,7 @@ public final class Message extends Stanza implements TypedCloneable { } @Override - public XmlStringBuilder toXML(String enclosingNamespace) { + public XmlStringBuilder toXML(org.jivesoftware.smack.packet.XmlEnvironment enclosingNamespace) { XmlStringBuilder xml = new XmlStringBuilder(); xml.halfOpenElement(getElementName()).optXmlLangAttribute(getLanguage()).rightAngleBracket(); xml.escape(subject); @@ -708,8 +708,8 @@ public final class Message extends Stanza implements TypedCloneable { } @Override - public XmlStringBuilder toXML(String enclosingNamespace) { - XmlStringBuilder xml = new XmlStringBuilder(this, enclosingNamespace); + public XmlStringBuilder toXML(XmlEnvironment enclosingXmlEnvironment) { + XmlStringBuilder xml = new XmlStringBuilder(this, enclosingXmlEnvironment); xml.optXmlLangAttribute(getLanguage()).rightAngleBracket(); xml.escape(message); xml.closeElement(getElementName()); 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 99a0b8ae1..2279cde26 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 @@ -272,7 +272,7 @@ public final class Presence extends Stanza implements TypedCloneable { } @Override - public XmlStringBuilder toXML(String enclosingNamespace) { + public XmlStringBuilder toXML(org.jivesoftware.smack.packet.XmlEnvironment enclosingNamespace) { XmlStringBuilder buf = new XmlStringBuilder(enclosingNamespace); buf.halfOpenElement(ELEMENT); addCommonAttributes(buf, enclosingNamespace); diff --git a/smack-core/src/main/java/org/jivesoftware/smack/packet/Session.java b/smack-core/src/main/java/org/jivesoftware/smack/packet/Session.java index 4b5d793cd..a226b729d 100644 --- a/smack-core/src/main/java/org/jivesoftware/smack/packet/Session.java +++ b/smack-core/src/main/java/org/jivesoftware/smack/packet/Session.java @@ -67,7 +67,7 @@ public class Session extends SimpleIQ { } @Override - public XmlStringBuilder toXML(String enclosingNamespace) { + public XmlStringBuilder toXML(org.jivesoftware.smack.packet.XmlEnvironment enclosingNamespace) { XmlStringBuilder xml = new XmlStringBuilder(this); if (optional) { xml.rightAngleBracket(); diff --git a/smack-core/src/main/java/org/jivesoftware/smack/packet/StandardExtensionElement.java b/smack-core/src/main/java/org/jivesoftware/smack/packet/StandardExtensionElement.java index ef9b42b16..74d598bc6 100644 --- a/smack-core/src/main/java/org/jivesoftware/smack/packet/StandardExtensionElement.java +++ b/smack-core/src/main/java/org/jivesoftware/smack/packet/StandardExtensionElement.java @@ -132,7 +132,7 @@ public final class StandardExtensionElement implements ExtensionElement { } @Override - public XmlStringBuilder toXML(String enclosingNamespace) { + public XmlStringBuilder toXML(org.jivesoftware.smack.packet.XmlEnvironment enclosingNamespace) { if (xmlCache != null) { return xmlCache; } diff --git a/smack-core/src/main/java/org/jivesoftware/smack/packet/Stanza.java b/smack-core/src/main/java/org/jivesoftware/smack/packet/Stanza.java index 3104870e0..21e6d79d4 100644 --- a/smack-core/src/main/java/org/jivesoftware/smack/packet/Stanza.java +++ b/smack-core/src/main/java/org/jivesoftware/smack/packet/Stanza.java @@ -503,25 +503,30 @@ public abstract class Stanza implements TopLevelStreamElement { * Add to, from, id and 'xml:lang' attributes * * @param xml the {@link XmlStringBuilder}. - * @param enclosingNamespace the enclosing XML namespace. - * @return the set namespace for this stanza. + * @param enclosingXmlEnvironment the enclosing XML namespace. + * @return the XML environment for this stanza. */ - protected String addCommonAttributes(XmlStringBuilder xml, String enclosingNamespace) { - String namespace; - if (enclosingNamespace == null || !enclosingNamespace.equals(StreamOpen.CLIENT_NAMESPACE) - || !enclosingNamespace.equals(StreamOpen.SERVER_NAMESPACE)) { - namespace = StreamOpen.CLIENT_NAMESPACE; - } else { - namespace = enclosingNamespace; + protected XmlEnvironment addCommonAttributes(XmlStringBuilder xml, XmlEnvironment enclosingXmlEnvironment) { + String language = getLanguage(); + String namespace = StreamOpen.CLIENT_NAMESPACE; + if (enclosingXmlEnvironment != null) { + String effectiveEnclosingNamespace = enclosingXmlEnvironment.getEffectiveNamespaceOrUse(namespace); + switch (effectiveEnclosingNamespace) { + case StreamOpen.CLIENT_NAMESPACE: + case StreamOpen.SERVER_NAMESPACE: + break; + default: + namespace = effectiveEnclosingNamespace; + } } xml.xmlnsAttribute(namespace); xml.optAttribute("to", getTo()); xml.optAttribute("from", getFrom()); xml.optAttribute("id", getStanzaId()); - xml.xmllangAttribute(getLanguage()); + xml.xmllangAttribute(language); - return namespace; + return new XmlEnvironment(namespace, language); } protected void logCommonAttributes(StringBuilder sb) { @@ -541,10 +546,10 @@ public abstract class Stanza implements TopLevelStreamElement { * * @param xml the XmlStringBuilder to append the error to. */ - protected void appendErrorIfExists(XmlStringBuilder xml, String enclosingNamespace) { + protected void appendErrorIfExists(XmlStringBuilder xml, XmlEnvironment enclosingXmlEnvironment) { StanzaError error = getError(); if (error != null) { - xml.append(error.toXML(enclosingNamespace)); + xml.append(error.toXML(enclosingXmlEnvironment)); } } } diff --git a/smack-core/src/main/java/org/jivesoftware/smack/packet/StanzaError.java b/smack-core/src/main/java/org/jivesoftware/smack/packet/StanzaError.java index fad9f5253..f6cd5f4c6 100644 --- a/smack-core/src/main/java/org/jivesoftware/smack/packet/StanzaError.java +++ b/smack-core/src/main/java/org/jivesoftware/smack/packet/StanzaError.java @@ -1,6 +1,6 @@ /** * - * Copyright 2003-2007 Jive Software, 2015-2018 Florian Schmaus + * Copyright 2003-2007 Jive Software, 2015-2019 Florian Schmaus * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -214,17 +214,8 @@ public class StanzaError extends AbstractError implements ExtensionElement { return StreamOpen.CLIENT_NAMESPACE; } - /** - * Returns the error as XML. - * - * @return the error as XML. - */ - public XmlStringBuilder toXML() { - return toXML(null); - } - @Override - public XmlStringBuilder toXML(String enclosingNamespace) { + public XmlStringBuilder toXML(XmlEnvironment enclosingNamespace) { XmlStringBuilder xml = new XmlStringBuilder(this, enclosingNamespace); xml.attribute("type", type.toString()); xml.optAttribute("by", errorGenerator); diff --git a/smack-core/src/main/java/org/jivesoftware/smack/packet/StartTls.java b/smack-core/src/main/java/org/jivesoftware/smack/packet/StartTls.java index bea488ad1..3da2c3a53 100644 --- a/smack-core/src/main/java/org/jivesoftware/smack/packet/StartTls.java +++ b/smack-core/src/main/java/org/jivesoftware/smack/packet/StartTls.java @@ -50,7 +50,7 @@ public class StartTls implements Nonza { } @Override - public XmlStringBuilder toXML(String enclosingNamespace) { + public XmlStringBuilder toXML(org.jivesoftware.smack.packet.XmlEnvironment enclosingNamespace) { XmlStringBuilder xml = new XmlStringBuilder(this, enclosingNamespace); xml.rightAngleBracket(); xml.condEmptyElement(required, "required"); diff --git a/smack-core/src/main/java/org/jivesoftware/smack/packet/StreamClose.java b/smack-core/src/main/java/org/jivesoftware/smack/packet/StreamClose.java index bba37b6fe..377e6c616 100644 --- a/smack-core/src/main/java/org/jivesoftware/smack/packet/StreamClose.java +++ b/smack-core/src/main/java/org/jivesoftware/smack/packet/StreamClose.java @@ -24,7 +24,7 @@ public final class StreamClose implements Nonza { } @Override - public String toXML(String enclosingNamespace) { + public String toXML(org.jivesoftware.smack.packet.XmlEnvironment enclosingNamespace) { return "'; } diff --git a/smack-core/src/main/java/org/jivesoftware/smack/packet/StreamError.java b/smack-core/src/main/java/org/jivesoftware/smack/packet/StreamError.java index 67ec3ec2a..e5e4b1d92 100644 --- a/smack-core/src/main/java/org/jivesoftware/smack/packet/StreamError.java +++ b/smack-core/src/main/java/org/jivesoftware/smack/packet/StreamError.java @@ -136,11 +136,11 @@ public class StreamError extends AbstractError implements Nonza { @Override public String toString() { - return toXML(null).toString(); + return toXML().toString(); } @Override - public XmlStringBuilder toXML(String enclosingNamespace) { + public XmlStringBuilder toXML(org.jivesoftware.smack.packet.XmlEnvironment enclosingNamespace) { XmlStringBuilder xml = new XmlStringBuilder(); xml.openElement(ELEMENT); xml.halfOpenElement(condition.toString()).xmlnsAttribute(NAMESPACE).closeEmptyElement(); diff --git a/smack-core/src/main/java/org/jivesoftware/smack/packet/StreamOpen.java b/smack-core/src/main/java/org/jivesoftware/smack/packet/StreamOpen.java index b9a4a8bf9..83dd802cd 100644 --- a/smack-core/src/main/java/org/jivesoftware/smack/packet/StreamOpen.java +++ b/smack-core/src/main/java/org/jivesoftware/smack/packet/StreamOpen.java @@ -96,14 +96,16 @@ public class StreamOpen implements Nonza { } @Override - public XmlStringBuilder toXML(String enclosingNamespace) { + public XmlStringBuilder toXML(XmlEnvironment enclosingXmlEnvironment) { XmlStringBuilder xml = new XmlStringBuilder(); xml.halfOpenElement(getElementName()); + + String namespace = CLIENT_NAMESPACE; // We always want to state 'xmlns' for stream open tags. - if (enclosingNamespace == null) { - enclosingNamespace = CLIENT_NAMESPACE; + if (enclosingXmlEnvironment != null) { + namespace = enclosingXmlEnvironment.getEffectiveNamespaceOrUse(CLIENT_NAMESPACE); } - xml.attribute("xmlns", enclosingNamespace); + xml.attribute("xmlns", namespace); xml.attribute("to", to); xml.attribute("xmlns:stream", "http://etherx.jabber.org/streams"); diff --git a/smack-core/src/main/java/org/jivesoftware/smack/packet/TlsFailure.java b/smack-core/src/main/java/org/jivesoftware/smack/packet/TlsFailure.java index d64ef1984..05aa4b6fa 100644 --- a/smack-core/src/main/java/org/jivesoftware/smack/packet/TlsFailure.java +++ b/smack-core/src/main/java/org/jivesoftware/smack/packet/TlsFailure.java @@ -37,7 +37,7 @@ public final class TlsFailure implements Nonza { } @Override - public String toXML(String enclosingNamespace) { + public String toXML(org.jivesoftware.smack.packet.XmlEnvironment enclosingNamespace) { return '<' + ELEMENT + " xmlns='" + NAMESPACE + "'/>"; } } diff --git a/smack-core/src/main/java/org/jivesoftware/smack/packet/TlsProceed.java b/smack-core/src/main/java/org/jivesoftware/smack/packet/TlsProceed.java index 19d80671b..7967a89b7 100644 --- a/smack-core/src/main/java/org/jivesoftware/smack/packet/TlsProceed.java +++ b/smack-core/src/main/java/org/jivesoftware/smack/packet/TlsProceed.java @@ -37,7 +37,7 @@ public final class TlsProceed implements Nonza { } @Override - public String toXML(String enclosingNamespace) { + public String toXML(org.jivesoftware.smack.packet.XmlEnvironment enclosingNamespace) { return '<' + ELEMENT + " xmlns='" + NAMESPACE + "'/>"; } } diff --git a/smack-core/src/main/java/org/jivesoftware/smack/packet/XmlEnvironment.java b/smack-core/src/main/java/org/jivesoftware/smack/packet/XmlEnvironment.java new file mode 100644 index 000000000..c84f4d5e5 --- /dev/null +++ b/smack-core/src/main/java/org/jivesoftware/smack/packet/XmlEnvironment.java @@ -0,0 +1,134 @@ +/** + * + * Copyright 2019 Florian Schmaus + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.jivesoftware.smack.packet; + +import org.jivesoftware.smack.util.StringUtils; + +public class XmlEnvironment { + + public static final XmlEnvironment EMPTY = new XmlEnvironment((String) null); + + private final String namespace; + private final String language; + private final XmlEnvironment next; + + private transient boolean effectiveNamespaceDetermined; + private transient boolean effectiveLanguageDetermined; + private transient String effectiveNamespace; + private transient String effectiveLanguage; + + public XmlEnvironment(String namespace) { + this(namespace, null); + } + + public XmlEnvironment(String namespace, String language) { + this(namespace, language, null); + } + + private XmlEnvironment(Builder builder) { + this(builder.namespace, builder.language, builder.next); + } + + private XmlEnvironment(String namespace, String language, XmlEnvironment next) { + this.namespace = namespace; + this.language = language; + this.next = next; + } + + public String getNamespace() { + return namespace; + } + + public String getEffectiveNamespace() { + if (effectiveNamespaceDetermined) { + return effectiveNamespace; + } + + if (StringUtils.isNotEmpty(namespace)) { + effectiveNamespace = namespace; + } else if (next != null) { + effectiveNamespace = next.getEffectiveNamespace(); + } + + effectiveNamespaceDetermined = true; + return effectiveNamespace; + } + + public String getEffectiveNamespaceOrUse(String namespace) { + String effectiveNamespace = getEffectiveLanguage(); + if (StringUtils.isNullOrEmpty(effectiveNamespace)) { + return namespace; + } + return effectiveNamespace; + } + + public boolean effectiveNamespaceEquals(String namespace) { + String effectiveNamespace = getEffectiveNamespace(); + if (effectiveNamespace == null) { + return false; + } + return effectiveNamespace.equals(namespace); + } + + public String getLanguage() { + return language; + } + + public String getEffectiveLanguage() { + if (effectiveLanguageDetermined) { + return effectiveLanguage; + } + + if (StringUtils.isNotEmpty(language)) { + effectiveLanguage = language; + } else if (next != null) { + effectiveLanguage = next.getEffectiveLanguage(); + } + + effectiveLanguageDetermined = true; + return effectiveLanguage; + } + + public static Builder builder() { + return new Builder(); + } + + public static class Builder { + private String namespace; + private String language; + private XmlEnvironment next; + + public Builder withNamespace(String namespace) { + this.namespace = namespace; + return this; + } + + public Builder withLanguage(String language) { + this.language = language; + return this; + } + + public Builder withNext(XmlEnvironment next) { + this.next = next; + return this; + } + + public XmlEnvironment build() { + return new XmlEnvironment(this); + } + } +} diff --git a/smack-core/src/main/java/org/jivesoftware/smack/sasl/packet/SaslStreamElements.java b/smack-core/src/main/java/org/jivesoftware/smack/sasl/packet/SaslStreamElements.java index 8d046669b..f59205dbf 100644 --- a/smack-core/src/main/java/org/jivesoftware/smack/sasl/packet/SaslStreamElements.java +++ b/smack-core/src/main/java/org/jivesoftware/smack/sasl/packet/SaslStreamElements.java @@ -44,7 +44,7 @@ public class SaslStreamElements { } @Override - public XmlStringBuilder toXML(String enclosingNamespace) { + public XmlStringBuilder toXML(org.jivesoftware.smack.packet.XmlEnvironment enclosingNamespace) { XmlStringBuilder xml = new XmlStringBuilder(); xml.halfOpenElement(ELEMENT).xmlnsAttribute(NAMESPACE).attribute("mechanism", mechanism).rightAngleBracket(); xml.optAppend(authenticationText); @@ -84,7 +84,7 @@ public class SaslStreamElements { } @Override - public XmlStringBuilder toXML(String enclosingNamespace) { + public XmlStringBuilder toXML(org.jivesoftware.smack.packet.XmlEnvironment enclosingNamespace) { XmlStringBuilder xml = new XmlStringBuilder().halfOpenElement(ELEMENT).xmlnsAttribute( NAMESPACE).rightAngleBracket(); xml.optAppend(data); @@ -120,7 +120,7 @@ public class SaslStreamElements { } @Override - public XmlStringBuilder toXML(String enclosingNamespace) { + public XmlStringBuilder toXML(org.jivesoftware.smack.packet.XmlEnvironment enclosingNamespace) { XmlStringBuilder xml = new XmlStringBuilder(); xml.halfOpenElement(ELEMENT).xmlnsAttribute(NAMESPACE).rightAngleBracket(); xml.optAppend(authenticationText); @@ -171,7 +171,7 @@ public class SaslStreamElements { } @Override - public XmlStringBuilder toXML(String enclosingNamespace) { + public XmlStringBuilder toXML(org.jivesoftware.smack.packet.XmlEnvironment enclosingNamespace) { XmlStringBuilder xml = new XmlStringBuilder(); xml.halfOpenElement(ELEMENT).xmlnsAttribute(NAMESPACE).rightAngleBracket(); xml.optAppend(data); @@ -236,7 +236,7 @@ public class SaslStreamElements { } @Override - public XmlStringBuilder toXML(String enclosingNamespace) { + public XmlStringBuilder toXML(org.jivesoftware.smack.packet.XmlEnvironment enclosingNamespace) { XmlStringBuilder xml = new XmlStringBuilder(); xml.halfOpenElement(ELEMENT).xmlnsAttribute(NAMESPACE).rightAngleBracket(); xml.emptyElement(saslErrorString); @@ -247,7 +247,7 @@ public class SaslStreamElements { @Override public String toString() { - return toXML(null).toString(); + return toXML().toString(); } @Override diff --git a/smack-core/src/main/java/org/jivesoftware/smack/util/XmlStringBuilder.java b/smack-core/src/main/java/org/jivesoftware/smack/util/XmlStringBuilder.java index c456557e3..92b1f6a33 100644 --- a/smack-core/src/main/java/org/jivesoftware/smack/util/XmlStringBuilder.java +++ b/smack-core/src/main/java/org/jivesoftware/smack/util/XmlStringBuilder.java @@ -1,6 +1,6 @@ /** * - * Copyright 2014-2018 Florian Schmaus + * Copyright 2014-2019 Florian Schmaus * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -26,6 +26,7 @@ import org.jivesoftware.smack.packet.Element; import org.jivesoftware.smack.packet.ExtensionElement; import org.jivesoftware.smack.packet.FullyQualifiedElement; import org.jivesoftware.smack.packet.NamedElement; +import org.jivesoftware.smack.packet.XmlEnvironment; import org.jxmpp.util.XmppDateTime; @@ -34,15 +35,15 @@ public class XmlStringBuilder implements Appendable, CharSequence, Element { private final LazyStringBuilder sb; - private final String enclosingNamespace; + private final XmlEnvironment effectiveXmlEnvironment; public XmlStringBuilder() { - this(""); + this((XmlEnvironment) null); } - public XmlStringBuilder(String enclosingNamespace) { + public XmlStringBuilder(XmlEnvironment effectiveXmlEnvironment) { sb = new LazyStringBuilder(); - this.enclosingNamespace = enclosingNamespace != null ? enclosingNamespace : ""; + this.effectiveXmlEnvironment = effectiveXmlEnvironment; } public XmlStringBuilder(ExtensionElement pe) { @@ -55,8 +56,8 @@ public class XmlStringBuilder implements Appendable, CharSequence, Element { halfOpenElement(e.getElementName()); } - public XmlStringBuilder(FullyQualifiedElement ee, String enclosingNamespace) { - this(enclosingNamespace); + public XmlStringBuilder(FullyQualifiedElement ee, XmlEnvironment enclosingXmlEnvironment) { + this(enclosingXmlEnvironment); prelude(ee); } @@ -117,7 +118,7 @@ public class XmlStringBuilder implements Appendable, CharSequence, Element { public XmlStringBuilder element(Element element) { assert element != null; - return append(element.toXML(null)); + return append(element.toXML()); } public XmlStringBuilder optElement(String name, String content) { @@ -152,7 +153,7 @@ public class XmlStringBuilder implements Appendable, CharSequence, Element { public XmlStringBuilder optElement(Element element) { if (element != null) { - append(element.toXML(null)); + append(element.toXML()); } return this; } @@ -399,10 +400,12 @@ public class XmlStringBuilder implements Appendable, CharSequence, Element { } public XmlStringBuilder xmlnsAttribute(String value) { - if (value != null && !enclosingNamespace.equals(value)) { - XmlNsAttribute xmlNsAttribute = new XmlNsAttribute(value); - append(xmlNsAttribute); + if (value == null || (effectiveXmlEnvironment != null + && effectiveXmlEnvironment.effectiveNamespaceEquals(value))) { + return this; } + XmlNsAttribute xmlNsAttribute = new XmlNsAttribute(value); + append(xmlNsAttribute); return this; } @@ -460,7 +463,7 @@ public class XmlStringBuilder implements Appendable, CharSequence, Element { public XmlStringBuilder optAppend(Element element) { if (element != null) { - append(element.toXML(enclosingNamespace)); + append(element.toXML(effectiveXmlEnvironment)); } return this; } @@ -475,9 +478,9 @@ public class XmlStringBuilder implements Appendable, CharSequence, Element { return append(elements, null); } - public XmlStringBuilder append(Collection elements, String enclosingNamespace) { + public XmlStringBuilder append(Collection elements, XmlEnvironment enclosingXmlEnvironment) { for (Element element : elements) { - append(element.toXML(enclosingNamespace)); + append(element.toXML(enclosingXmlEnvironment)); } return this; } @@ -592,22 +595,22 @@ public class XmlStringBuilder implements Appendable, CharSequence, Element { } @Override - public CharSequence toXML(String enclosingNamespace) { + public CharSequence toXML(XmlEnvironment enclosingXmlEnvironment) { StringBuilder res = new StringBuilder(); - appendXmlTo(res, enclosingNamespace); + appendXmlTo(res, enclosingXmlEnvironment); return res; } - private void appendXmlTo(StringBuilder res, String enclosingNamespace) { + private void appendXmlTo(StringBuilder res, XmlEnvironment enclosingXmlEnvironment) { for (CharSequence csq : sb.getAsList()) { if (csq instanceof XmlStringBuilder) { - ((XmlStringBuilder) csq).appendXmlTo(res, enclosingNamespace); + ((XmlStringBuilder) csq).appendXmlTo(res, enclosingXmlEnvironment); } else if (csq instanceof XmlNsAttribute) { XmlNsAttribute xmlNsAttribute = (XmlNsAttribute) csq; - if (!xmlNsAttribute.value.equals(enclosingNamespace)) { + if (!xmlNsAttribute.value.equals(enclosingXmlEnvironment.getEffectiveNamespace())) { sb.append(xmlNsAttribute); - enclosingNamespace = xmlNsAttribute.value; + enclosingXmlEnvironment = new XmlEnvironment(xmlNsAttribute.value); } } else { diff --git a/smack-core/src/test/java/org/jivesoftware/smack/StanzaCollectorTest.java b/smack-core/src/test/java/org/jivesoftware/smack/StanzaCollectorTest.java index eaeb3b34e..d2c1c3b0b 100644 --- a/smack-core/src/test/java/org/jivesoftware/smack/StanzaCollectorTest.java +++ b/smack-core/src/test/java/org/jivesoftware/smack/StanzaCollectorTest.java @@ -182,13 +182,13 @@ public class StanzaCollectorTest { } @Override - public String toXML(String enclosingNamespace) { + public String toXML(org.jivesoftware.smack.packet.XmlEnvironment enclosingNamespace) { return "" + getStanzaId() + ""; } @Override public String toString() { - return toXML(null); + return toXML().toString(); } } } diff --git a/smack-core/src/test/java/org/jivesoftware/smack/compress/packet/FailureTest.java b/smack-core/src/test/java/org/jivesoftware/smack/compress/packet/FailureTest.java index 9ad9a600f..aadbdb38e 100644 --- a/smack-core/src/test/java/org/jivesoftware/smack/compress/packet/FailureTest.java +++ b/smack-core/src/test/java/org/jivesoftware/smack/compress/packet/FailureTest.java @@ -31,7 +31,7 @@ public class FailureTest { @Test public void simpleFailureTest() throws SAXException, IOException { Failure failure = new Failure(Failure.CompressFailureError.processing_failed); - CharSequence xml = failure.toXML(null); + CharSequence xml = failure.toXML(); final String expectedXml = ""; @@ -44,7 +44,7 @@ public class FailureTest { .setCondition(Condition.bad_request) .build(); Failure failure = new Failure(Failure.CompressFailureError.setup_failed, stanzaError); - CharSequence xml = failure.toXML(null); + CharSequence xml = failure.toXML(); final String expectedXml = "" + "" diff --git a/smack-core/src/test/java/org/jivesoftware/smack/packet/IQResponseTest.java b/smack-core/src/test/java/org/jivesoftware/smack/packet/IQResponseTest.java index c0a982188..ff2c1ce69 100644 --- a/smack-core/src/test/java/org/jivesoftware/smack/packet/IQResponseTest.java +++ b/smack-core/src/test/java/org/jivesoftware/smack/packet/IQResponseTest.java @@ -75,7 +75,7 @@ public class IQResponseTest { assertNotNull(result.getStanzaId()); assertEquals(request.getStanzaId(), result.getStanzaId()); assertEquals(request.getFrom(), result.getTo()); - assertEquals(error.build().toXML(), result.getError().toXML()); + assertEquals(error.build().toXML().toString(), result.getError().toXML().toString()); // TODO this test was never valid // assertEquals(CHILD_ELEMENT, result.getChildElementXML()); } diff --git a/smack-core/src/test/java/org/jivesoftware/smack/packet/XmlEnvironmentTest.java b/smack-core/src/test/java/org/jivesoftware/smack/packet/XmlEnvironmentTest.java new file mode 100644 index 000000000..bca53dde2 --- /dev/null +++ b/smack-core/src/test/java/org/jivesoftware/smack/packet/XmlEnvironmentTest.java @@ -0,0 +1,44 @@ +/** + * + * Copyright 2019 Florian Schmaus + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.jivesoftware.smack.packet; + +import static org.junit.Assert.assertEquals; + +import org.junit.Test; + +public class XmlEnvironmentTest { + + @Test + public void testNamespaceScope() { + final String outerNamespace = "outerNamespace"; + + XmlEnvironment outer = XmlEnvironment.builder().withNamespace(outerNamespace).build(); + XmlEnvironment inner = XmlEnvironment.builder().withNext(outer).build(); + + assertEquals(outerNamespace, inner.getEffectiveNamespace()); + } + + @Test + public void testLanguageScope() { + final String outerLanguage = "outerLanguage"; + + XmlEnvironment outer = XmlEnvironment.builder().withLanguage(outerLanguage).build(); + XmlEnvironment inner = XmlEnvironment.builder().withNext(outer).build(); + + assertEquals(outerLanguage, inner.getEffectiveLanguage()); + } +} diff --git a/smack-core/src/test/java/org/jivesoftware/smack/parsing/StandardExtensionElementParserTest.java b/smack-core/src/test/java/org/jivesoftware/smack/parsing/StandardExtensionElementParserTest.java index 69d5f7b6a..b0b48ad5b 100644 --- a/smack-core/src/test/java/org/jivesoftware/smack/parsing/StandardExtensionElementParserTest.java +++ b/smack-core/src/test/java/org/jivesoftware/smack/parsing/StandardExtensionElementParserTest.java @@ -31,7 +31,7 @@ public class StandardExtensionElementParserTest { builder.addAttribute("attr1", "attr1-value"); builder.addElement(StandardExtensionElement.builder("bar", "ns2").addAttribute("attr2", "attr2-value").build()); builder.addElement("another-element", "another-element-text"); - final String elementString = builder.build().toXML(null).toString(); + final String elementString = builder.build().toXML().toString(); StandardExtensionElement parsedElement = StandardExtensionElementProvider.INSTANCE.parse(getParserFor(elementString)); @@ -46,7 +46,7 @@ public class StandardExtensionElementParserTest { assertEquals("another-element-text", parsedElement.getFirstElement("another-element").getText()); - String parsedElementString = parsedElement.toXML(null).toString(); + String parsedElementString = parsedElement.toXML().toString(); assertEquals(elementString, parsedElementString); } @@ -55,7 +55,7 @@ public class StandardExtensionElementParserTest { StandardExtensionElement.Builder builder = StandardExtensionElement.builder("foo", "ns1-value"); builder.addAttribute("xmlns:ns2", "ns2-value"); builder.addAttribute("ns2:bar", "bar-ns2-value"); - final String elementString = builder.build().toXML(null).toString(); + final String elementString = builder.build().toXML().toString(); StandardExtensionElement parsedElement = StandardExtensionElementProvider.INSTANCE.parse(getParserFor(elementString)); assertEquals("foo", parsedElement.getElementName()); diff --git a/smack-core/src/test/java/org/jivesoftware/smack/util/PacketParserUtilsTest.java b/smack-core/src/test/java/org/jivesoftware/smack/util/PacketParserUtilsTest.java index 06093a468..c2ed877f5 100644 --- a/smack-core/src/test/java/org/jivesoftware/smack/util/PacketParserUtilsTest.java +++ b/smack-core/src/test/java/org/jivesoftware/smack/util/PacketParserUtilsTest.java @@ -85,7 +85,7 @@ public class PacketParserUtilsTest { assertTrue(message.getBodyLanguages().isEmpty()); assertEquals(defaultLanguage, message.getBody(defaultLanguage)); assertNull(message.getBody(otherLanguage)); - assertXMLEqual(control, message.toXML(null).toString()); + assertXMLEqual(control, message.toXML().toString()); // message has non-default language, body has no language control = XMLBuilder.create("message") @@ -105,7 +105,7 @@ public class PacketParserUtilsTest { assertTrue(message.getBodyLanguages().isEmpty()); assertEquals(otherLanguage, message.getBody(otherLanguage)); assertNull(message.getBody(defaultLanguage)); - assertXMLEqual(control, message.toXML(null).toString()); + assertXMLEqual(control, message.toXML().toString()); // message has no language, body has no language control = XMLBuilder.create("message") @@ -124,7 +124,7 @@ public class PacketParserUtilsTest { assertTrue(message.getBodyLanguages().isEmpty()); assertEquals(defaultLanguage, message.getBody(null)); assertNull(message.getBody(otherLanguage)); - assertXMLEqual(control, message.toXML(null).toString()); + assertXMLEqual(control, message.toXML().toString()); // message has no language, body has default language control = XMLBuilder.create("message") @@ -145,7 +145,7 @@ public class PacketParserUtilsTest { assertEquals(defaultLanguage, message.getBody(defaultLanguage)); assertNull(message.getBody(otherLanguage)); - assertXMLEqual(control, message.toXML(null).toString()); + assertXMLEqual(control, message.toXML().toString()); // message has no language, body has non-default language control = XMLBuilder.create("message") @@ -166,7 +166,7 @@ public class PacketParserUtilsTest { assertTrue(message.getBodyLanguages().contains(otherLanguage)); assertEquals(otherLanguage, message.getBody(otherLanguage)); assertNull(message.getBody(defaultLanguage)); - assertXMLEqual(control, message.toXML(null).toString()); + assertXMLEqual(control, message.toXML().toString()); // message has default language, body has non-default language control = XMLBuilder.create("message") @@ -188,7 +188,7 @@ public class PacketParserUtilsTest { assertTrue(message.getBodyLanguages().contains(otherLanguage)); assertEquals(otherLanguage, message.getBody(otherLanguage)); assertNull(message.getBody(defaultLanguage)); - assertXMLEqual(control, message.toXML(null).toString()); + assertXMLEqual(control, message.toXML().toString()); // message has non-default language, body has default language control = XMLBuilder.create("message") @@ -210,7 +210,7 @@ public class PacketParserUtilsTest { assertTrue(message.getBodyLanguages().contains(defaultLanguage)); assertEquals(defaultLanguage, message.getBody(defaultLanguage)); assertNull(message.getBody(otherLanguage)); - assertXMLEqual(control, message.toXML(null).toString()); + assertXMLEqual(control, message.toXML().toString()); } @@ -393,7 +393,7 @@ public class PacketParserUtilsTest { assertEquals(2, message.getBodies().size()); assertEquals(1, message.getBodyLanguages().size()); assertTrue(message.getBodyLanguages().contains(otherLanguage)); - assertXMLEqual(control, message.toXML(null).toString()); + assertXMLEqual(control, message.toXML().toString()); // message has non-default language, first body no language, second body default language control = XMLBuilder.create("message") @@ -419,7 +419,7 @@ public class PacketParserUtilsTest { assertEquals(2, message.getBodies().size()); assertEquals(1, message.getBodyLanguages().size()); assertTrue(message.getBodyLanguages().contains(defaultLanguage)); - assertXMLEqual(control, message.toXML(null).toString()); + assertXMLEqual(control, message.toXML().toString()); } // TODO: Re-enable once we throw an exception on duplicate body elements. @@ -452,7 +452,7 @@ public class PacketParserUtilsTest { assertEquals(defaultLanguage, message.getBody(defaultLanguage)); assertEquals(1, message.getBodies().size()); assertEquals(0, message.getBodyLanguages().size()); - assertXMLNotEqual(control, message.toXML(null).toString()); + assertXMLNotEqual(control, message.toXML().toString()); } @Ignore @@ -510,7 +510,7 @@ public class PacketParserUtilsTest { assertEquals(otherLanguage, message.getBody(otherLanguage)); assertEquals(2, message.getBodies().size()); assertEquals(1, message.getBodyLanguages().size()); - assertXMLEqual(control, message.toXML(null).toString()); + assertXMLEqual(control, message.toXML().toString()); } @Test @@ -692,7 +692,7 @@ public class PacketParserUtilsTest { Message message = PacketParserUtils.parseMessage(TestUtils.getMessageParser(control)); - fail("Should throw exception. Instead got message: " + message.toXML(null).toString()); + fail("Should throw exception. Instead got message: " + message.toXML().toString()); } @Test @@ -763,7 +763,7 @@ public class PacketParserUtilsTest { .asString(outputProperties); Stanza message = PacketParserUtils.parseStanza(control); - XmlUnitUtils.assertSimilar(control, message.toXML(null)); + XmlUnitUtils.assertSimilar(control, message.toXML()); } @Test diff --git a/smack-debug-slf4j/src/main/java/org/jivesoftware/smackx/debugger/slf4j/SLF4JSmackDebugger.java b/smack-debug-slf4j/src/main/java/org/jivesoftware/smackx/debugger/slf4j/SLF4JSmackDebugger.java index 1aa66efee..61523870a 100644 --- a/smack-debug-slf4j/src/main/java/org/jivesoftware/smackx/debugger/slf4j/SLF4JSmackDebugger.java +++ b/smack-debug-slf4j/src/main/java/org/jivesoftware/smackx/debugger/slf4j/SLF4JSmackDebugger.java @@ -105,14 +105,14 @@ public class SLF4JSmackDebugger extends SmackDebugger { @Override public void onIncomingStreamElement(TopLevelStreamElement streamElement) { if (SLF4JSmackDebugger.printInterpreted.get() && logger.isDebugEnabled()) { - logger.debug("IN {}: {}", streamElement.getClass().getName(), streamElement.toXML(null)); + logger.debug("IN {}: {}", streamElement.getClass().getName(), streamElement.toXML()); } } @Override public void onOutgoingStreamElement(TopLevelStreamElement streamElement) { if (SLF4JSmackDebugger.printInterpreted.get() && logger.isDebugEnabled()) { - logger.debug("OUT {}: {}", streamElement.getClass().getName(), streamElement.toXML(null)); + logger.debug("OUT {}: {}", streamElement.getClass().getName(), streamElement.toXML()); } } diff --git a/smack-debug/src/main/java/org/jivesoftware/smackx/debugger/EnhancedDebugger.java b/smack-debug/src/main/java/org/jivesoftware/smackx/debugger/EnhancedDebugger.java index 06bfc4318..941ba25d1 100644 --- a/smack-debug/src/main/java/org/jivesoftware/smackx/debugger/EnhancedDebugger.java +++ b/smack-debug/src/main/java/org/jivesoftware/smackx/debugger/EnhancedDebugger.java @@ -74,6 +74,7 @@ import org.jivesoftware.smack.packet.Message; import org.jivesoftware.smack.packet.Presence; import org.jivesoftware.smack.packet.Stanza; import org.jivesoftware.smack.packet.TopLevelStreamElement; +import org.jivesoftware.smack.packet.XmlEnvironment; import org.jivesoftware.smack.util.ObservableReader; import org.jivesoftware.smack.util.ObservableWriter; import org.jivesoftware.smack.util.ReaderListener; @@ -810,7 +811,7 @@ public class EnhancedDebugger extends SmackDebugger { messagesTable.addRow( new Object[] { - XmlUtil.prettyFormatXml(packet.toXML(null).toString()), + XmlUtil.prettyFormatXml(packet.toXML().toString()), dateFormatter.format(new Date()), packetReceivedIcon, packetTypeIcon, @@ -881,7 +882,7 @@ public class EnhancedDebugger extends SmackDebugger { messagesTable.addRow( new Object[] { - XmlUtil.prettyFormatXml(packet.toXML(null).toString()), + XmlUtil.prettyFormatXml(packet.toXML().toString()), dateFormatter.format(new Date()), packetSentIcon, packetTypeIcon, @@ -938,15 +939,14 @@ public class EnhancedDebugger extends SmackDebugger { } @Override - public String toXML(String enclosingNamespace) { + public String toXML(XmlEnvironment enclosingNamespace) { return text; } @Override public String toString() { - return toXML(null); + return toXML((XmlEnvironment) null); } - } /** diff --git a/smack-debug/src/main/java/org/jivesoftware/smackx/debugger/LiteDebugger.java b/smack-debug/src/main/java/org/jivesoftware/smackx/debugger/LiteDebugger.java index a2a7c9813..3cf740fbc 100644 --- a/smack-debug/src/main/java/org/jivesoftware/smackx/debugger/LiteDebugger.java +++ b/smack-debug/src/main/java/org/jivesoftware/smackx/debugger/LiteDebugger.java @@ -323,8 +323,8 @@ public class LiteDebugger extends SmackDebugger { @Override public void onIncomingStreamElement(TopLevelStreamElement streamElement) { - interpretedText1.append(streamElement.toXML(null).toString()); - interpretedText2.append(streamElement.toXML(null).toString()); + interpretedText1.append(streamElement.toXML().toString()); + interpretedText2.append(streamElement.toXML().toString()); interpretedText1.append(NEWLINE); interpretedText2.append(NEWLINE); } diff --git a/smack-experimental/src/main/java/org/jivesoftware/smackx/carbons/packet/CarbonExtension.java b/smack-experimental/src/main/java/org/jivesoftware/smackx/carbons/packet/CarbonExtension.java index 26075613b..4ab1400af 100644 --- a/smack-experimental/src/main/java/org/jivesoftware/smackx/carbons/packet/CarbonExtension.java +++ b/smack-experimental/src/main/java/org/jivesoftware/smackx/carbons/packet/CarbonExtension.java @@ -79,10 +79,10 @@ public class CarbonExtension implements ExtensionElement { } @Override - public XmlStringBuilder toXML(String enclosingNamespace) { + public XmlStringBuilder toXML(org.jivesoftware.smack.packet.XmlEnvironment enclosingNamespace) { XmlStringBuilder xml = new XmlStringBuilder(this); xml.rightAngleBracket(); - xml.append(fwd.toXML(null)); + xml.append(fwd.toXML()); xml.closeElement(this); return xml; } @@ -150,7 +150,7 @@ public class CarbonExtension implements ExtensionElement { } @Override - public String toXML(String enclosingNamespace) { + public String toXML(org.jivesoftware.smack.packet.XmlEnvironment enclosingNamespace) { return "<" + ELEMENT + " xmlns='" + NAMESPACE + "'/>"; } diff --git a/smack-experimental/src/main/java/org/jivesoftware/smackx/chat_markers/element/ChatMarkersElements.java b/smack-experimental/src/main/java/org/jivesoftware/smackx/chat_markers/element/ChatMarkersElements.java index cc3529544..ebff125fa 100644 --- a/smack-experimental/src/main/java/org/jivesoftware/smackx/chat_markers/element/ChatMarkersElements.java +++ b/smack-experimental/src/main/java/org/jivesoftware/smackx/chat_markers/element/ChatMarkersElements.java @@ -65,7 +65,7 @@ public class ChatMarkersElements { } @Override - public CharSequence toXML(String enclosingNamespace) { + public CharSequence toXML(org.jivesoftware.smack.packet.XmlEnvironment enclosingNamespace) { XmlStringBuilder xml = new XmlStringBuilder(this); xml.closeEmptyElement(); return xml; @@ -93,7 +93,7 @@ public class ChatMarkersElements { } @Override - public final XmlStringBuilder toXML(String enclosingNamespace) { + public final XmlStringBuilder toXML(org.jivesoftware.smack.packet.XmlEnvironment enclosingNamespace) { XmlStringBuilder xml = new XmlStringBuilder(this); xml.attribute("id", id); xml.closeEmptyElement(); diff --git a/smack-experimental/src/main/java/org/jivesoftware/smackx/csi/packet/ClientStateIndication.java b/smack-experimental/src/main/java/org/jivesoftware/smackx/csi/packet/ClientStateIndication.java index ff85fde46..139161ac0 100644 --- a/smack-experimental/src/main/java/org/jivesoftware/smackx/csi/packet/ClientStateIndication.java +++ b/smack-experimental/src/main/java/org/jivesoftware/smackx/csi/packet/ClientStateIndication.java @@ -45,7 +45,7 @@ public class ClientStateIndication { } @Override - public String toXML(String enclosingNamespace) { + public String toXML(org.jivesoftware.smack.packet.XmlEnvironment enclosingNamespace) { return '<' + ELEMENT + " xmlns='" + NAMESPACE + "'/>"; } } @@ -68,7 +68,7 @@ public class ClientStateIndication { } @Override - public String toXML(String enclosingNamespace) { + public String toXML(org.jivesoftware.smack.packet.XmlEnvironment enclosingNamespace) { return '<' + ELEMENT + " xmlns='" + NAMESPACE + "'/>"; } } @@ -86,7 +86,7 @@ public class ClientStateIndication { } @Override - public String toXML(String enclosingNamespace) { + public String toXML(org.jivesoftware.smack.packet.XmlEnvironment enclosingNamespace) { return '<' + ELEMENT + " xmlns='" + NAMESPACE + "'/>"; } diff --git a/smack-experimental/src/main/java/org/jivesoftware/smackx/eme/element/ExplicitMessageEncryptionElement.java b/smack-experimental/src/main/java/org/jivesoftware/smackx/eme/element/ExplicitMessageEncryptionElement.java index 22273fd89..5e47cd34f 100644 --- a/smack-experimental/src/main/java/org/jivesoftware/smackx/eme/element/ExplicitMessageEncryptionElement.java +++ b/smack-experimental/src/main/java/org/jivesoftware/smackx/eme/element/ExplicitMessageEncryptionElement.java @@ -135,7 +135,7 @@ public class ExplicitMessageEncryptionElement implements ExtensionElement { } @Override - public XmlStringBuilder toXML(String enclosingNamespace) { + public XmlStringBuilder toXML(org.jivesoftware.smack.packet.XmlEnvironment enclosingNamespace) { XmlStringBuilder xml = new XmlStringBuilder(this); xml.attribute("namespace", getEncryptionNamespace()); xml.optAttribute("name", getName()); diff --git a/smack-experimental/src/main/java/org/jivesoftware/smackx/hashes/element/HashElement.java b/smack-experimental/src/main/java/org/jivesoftware/smackx/hashes/element/HashElement.java index 6ff6d3c95..9c8329923 100644 --- a/smack-experimental/src/main/java/org/jivesoftware/smackx/hashes/element/HashElement.java +++ b/smack-experimental/src/main/java/org/jivesoftware/smackx/hashes/element/HashElement.java @@ -93,7 +93,7 @@ public class HashElement implements ExtensionElement { } @Override - public CharSequence toXML(String enclosingNamespace) { + public CharSequence toXML(org.jivesoftware.smack.packet.XmlEnvironment enclosingNamespace) { XmlStringBuilder sb = new XmlStringBuilder(this); sb.attribute(ATTR_ALGO, algorithm.toString()); sb.rightAngleBracket(); @@ -120,6 +120,6 @@ public class HashElement implements ExtensionElement { @Override public int hashCode() { - return toXML(null).toString().hashCode(); + return toXML().toString().hashCode(); } } diff --git a/smack-experimental/src/main/java/org/jivesoftware/smackx/hints/element/NoCopyHint.java b/smack-experimental/src/main/java/org/jivesoftware/smackx/hints/element/NoCopyHint.java index a22a0f7b7..5cf5f33bc 100644 --- a/smack-experimental/src/main/java/org/jivesoftware/smackx/hints/element/NoCopyHint.java +++ b/smack-experimental/src/main/java/org/jivesoftware/smackx/hints/element/NoCopyHint.java @@ -38,7 +38,7 @@ public final class NoCopyHint extends MessageProcessingHint { } @Override - public String toXML(String enclosingNamespace) { + public String toXML(org.jivesoftware.smack.packet.XmlEnvironment enclosingNamespace) { return '<' + ELEMENT + " xmlns='" + NAMESPACE + "'/>"; } diff --git a/smack-experimental/src/main/java/org/jivesoftware/smackx/hints/element/NoPermanentStoreHint.java b/smack-experimental/src/main/java/org/jivesoftware/smackx/hints/element/NoPermanentStoreHint.java index ff27c5bb1..bbe68b9bc 100644 --- a/smack-experimental/src/main/java/org/jivesoftware/smackx/hints/element/NoPermanentStoreHint.java +++ b/smack-experimental/src/main/java/org/jivesoftware/smackx/hints/element/NoPermanentStoreHint.java @@ -38,7 +38,7 @@ public final class NoPermanentStoreHint extends MessageProcessingHint { } @Override - public String toXML(String enclosingNamespace) { + public String toXML(org.jivesoftware.smack.packet.XmlEnvironment enclosingNamespace) { return '<' + ELEMENT + " xmlns='" + NAMESPACE + "'/>"; } diff --git a/smack-experimental/src/main/java/org/jivesoftware/smackx/hints/element/NoStoreHint.java b/smack-experimental/src/main/java/org/jivesoftware/smackx/hints/element/NoStoreHint.java index 78e0f731a..a3bbd96cb 100644 --- a/smack-experimental/src/main/java/org/jivesoftware/smackx/hints/element/NoStoreHint.java +++ b/smack-experimental/src/main/java/org/jivesoftware/smackx/hints/element/NoStoreHint.java @@ -38,7 +38,7 @@ public final class NoStoreHint extends MessageProcessingHint { } @Override - public String toXML(String enclosingNamespace) { + public String toXML(org.jivesoftware.smack.packet.XmlEnvironment enclosingNamespace) { return '<' + ELEMENT + " xmlns='" + NAMESPACE + "'/>"; } diff --git a/smack-experimental/src/main/java/org/jivesoftware/smackx/hints/element/StoreHint.java b/smack-experimental/src/main/java/org/jivesoftware/smackx/hints/element/StoreHint.java index fdbed6cb3..aea9de720 100644 --- a/smack-experimental/src/main/java/org/jivesoftware/smackx/hints/element/StoreHint.java +++ b/smack-experimental/src/main/java/org/jivesoftware/smackx/hints/element/StoreHint.java @@ -38,7 +38,7 @@ public final class StoreHint extends MessageProcessingHint { } @Override - public String toXML(String enclosingNamespace) { + public String toXML(org.jivesoftware.smack.packet.XmlEnvironment enclosingNamespace) { return '<' + ELEMENT + " xmlns='" + NAMESPACE + "'/>"; } diff --git a/smack-experimental/src/main/java/org/jivesoftware/smackx/hoxt/packet/AbstractHttpOverXmpp.java b/smack-experimental/src/main/java/org/jivesoftware/smackx/hoxt/packet/AbstractHttpOverXmpp.java index ce3e64298..fee8eab9b 100644 --- a/smack-experimental/src/main/java/org/jivesoftware/smackx/hoxt/packet/AbstractHttpOverXmpp.java +++ b/smack-experimental/src/main/java/org/jivesoftware/smackx/hoxt/packet/AbstractHttpOverXmpp.java @@ -171,7 +171,7 @@ public abstract class AbstractHttpOverXmpp extends IQ { * @return xml representation of this object */ @Override - public XmlStringBuilder toXML(String enclosingNamespace) { + public XmlStringBuilder toXML(org.jivesoftware.smack.packet.XmlEnvironment enclosingNamespace) { XmlStringBuilder xml = new XmlStringBuilder(this); xml.rightAngleBracket(); xml.element(child); @@ -215,7 +215,7 @@ public abstract class AbstractHttpOverXmpp extends IQ { } @Override - public XmlStringBuilder toXML(String enclosingNamespace) { + public XmlStringBuilder toXML(org.jivesoftware.smack.packet.XmlEnvironment enclosingNamespace) { XmlStringBuilder xml = new XmlStringBuilder(this); xml.rightAngleBracket(); xml.optAppend(text); @@ -259,7 +259,7 @@ public abstract class AbstractHttpOverXmpp extends IQ { } @Override - public XmlStringBuilder toXML(String enclosingNamespace) { + public XmlStringBuilder toXML(org.jivesoftware.smack.packet.XmlEnvironment enclosingNamespace) { XmlStringBuilder xml = new XmlStringBuilder(this); xml.rightAngleBracket(); xml.optAppend(text); @@ -303,7 +303,7 @@ public abstract class AbstractHttpOverXmpp extends IQ { } @Override - public XmlStringBuilder toXML(String enclosingNamespace) { + public XmlStringBuilder toXML(org.jivesoftware.smack.packet.XmlEnvironment enclosingNamespace) { XmlStringBuilder xml = new XmlStringBuilder(this); xml.rightAngleBracket(); xml.optAppend(text); @@ -347,7 +347,7 @@ public abstract class AbstractHttpOverXmpp extends IQ { } @Override - public XmlStringBuilder toXML(String enclosingNamespace) { + public XmlStringBuilder toXML(org.jivesoftware.smack.packet.XmlEnvironment enclosingNamespace) { XmlStringBuilder xml = new XmlStringBuilder(this); xml.attribute("streamId", streamId); xml.closeEmptyElement(); @@ -390,7 +390,7 @@ public abstract class AbstractHttpOverXmpp extends IQ { } @Override - public XmlStringBuilder toXML(String enclosingNamespace) { + public XmlStringBuilder toXML(org.jivesoftware.smack.packet.XmlEnvironment enclosingNamespace) { XmlStringBuilder xml = new XmlStringBuilder(this); xml.attribute("sid", sid); xml.closeEmptyElement(); diff --git a/smack-experimental/src/main/java/org/jivesoftware/smackx/hoxt/packet/Base64BinaryChunk.java b/smack-experimental/src/main/java/org/jivesoftware/smackx/hoxt/packet/Base64BinaryChunk.java index d299d95c4..63393a628 100644 --- a/smack-experimental/src/main/java/org/jivesoftware/smackx/hoxt/packet/Base64BinaryChunk.java +++ b/smack-experimental/src/main/java/org/jivesoftware/smackx/hoxt/packet/Base64BinaryChunk.java @@ -117,7 +117,7 @@ public class Base64BinaryChunk implements ExtensionElement { } @Override - public XmlStringBuilder toXML(String enclosingNamespace) { + public XmlStringBuilder toXML(org.jivesoftware.smack.packet.XmlEnvironment enclosingNamespace) { XmlStringBuilder xml = new XmlStringBuilder(this); xml.attribute("streamId", streamId); xml.attribute("nr", nr); diff --git a/smack-experimental/src/main/java/org/jivesoftware/smackx/httpfileupload/element/FileTooLargeError.java b/smack-experimental/src/main/java/org/jivesoftware/smackx/httpfileupload/element/FileTooLargeError.java index 94d3bf10e..c81152e79 100644 --- a/smack-experimental/src/main/java/org/jivesoftware/smackx/httpfileupload/element/FileTooLargeError.java +++ b/smack-experimental/src/main/java/org/jivesoftware/smackx/httpfileupload/element/FileTooLargeError.java @@ -58,7 +58,7 @@ public class FileTooLargeError implements ExtensionElement { } @Override - public XmlStringBuilder toXML(String enclosingNamespace) { + public XmlStringBuilder toXML(org.jivesoftware.smack.packet.XmlEnvironment enclosingNamespace) { XmlStringBuilder xml = new XmlStringBuilder(this); xml.rightAngleBracket(); xml.element("max-file-size", String.valueOf(maxFileSize)); diff --git a/smack-experimental/src/main/java/org/jivesoftware/smackx/iot/control/element/SetData.java b/smack-experimental/src/main/java/org/jivesoftware/smackx/iot/control/element/SetData.java index 766cf1545..9c1e0e94e 100644 --- a/smack-experimental/src/main/java/org/jivesoftware/smackx/iot/control/element/SetData.java +++ b/smack-experimental/src/main/java/org/jivesoftware/smackx/iot/control/element/SetData.java @@ -82,7 +82,7 @@ public abstract class SetData implements NamedElement { * @return the stanza extension as XML. */ @Override - public final XmlStringBuilder toXML(String enclosingNamespace) { + public final XmlStringBuilder toXML(org.jivesoftware.smack.packet.XmlEnvironment enclosingNamespace) { XmlStringBuilder xml = new XmlStringBuilder(this); xml.attribute("name", name); xml.attribute("value", value); diff --git a/smack-experimental/src/main/java/org/jivesoftware/smackx/iot/data/element/IoTDataField.java b/smack-experimental/src/main/java/org/jivesoftware/smackx/iot/data/element/IoTDataField.java index 3a46f21a5..a3a31fa67 100644 --- a/smack-experimental/src/main/java/org/jivesoftware/smackx/iot/data/element/IoTDataField.java +++ b/smack-experimental/src/main/java/org/jivesoftware/smackx/iot/data/element/IoTDataField.java @@ -52,7 +52,7 @@ public abstract class IoTDataField implements NamedElement { } @Override - public final XmlStringBuilder toXML(String enclosingNamespace) { + public final XmlStringBuilder toXML(org.jivesoftware.smack.packet.XmlEnvironment enclosingNamespace) { XmlStringBuilder xml = new XmlStringBuilder(this); xml.attribute("name", name).attribute("value", getValueString()); // TODO handle 'unit' attribute as special case if is implemented. diff --git a/smack-experimental/src/main/java/org/jivesoftware/smackx/iot/data/element/IoTFieldsExtension.java b/smack-experimental/src/main/java/org/jivesoftware/smackx/iot/data/element/IoTFieldsExtension.java index 0bdc0c773..9831e392c 100644 --- a/smack-experimental/src/main/java/org/jivesoftware/smackx/iot/data/element/IoTFieldsExtension.java +++ b/smack-experimental/src/main/java/org/jivesoftware/smackx/iot/data/element/IoTFieldsExtension.java @@ -68,7 +68,7 @@ public class IoTFieldsExtension implements ExtensionElement { } @Override - public XmlStringBuilder toXML(String enclosingNamespace) { + public XmlStringBuilder toXML(org.jivesoftware.smack.packet.XmlEnvironment enclosingNamespace) { XmlStringBuilder xml = new XmlStringBuilder(this); xml.attribute("seqnr", Integer.toString(seqNr)); xml.attribute("done", done); diff --git a/smack-experimental/src/main/java/org/jivesoftware/smackx/iot/data/element/NodeElement.java b/smack-experimental/src/main/java/org/jivesoftware/smackx/iot/data/element/NodeElement.java index 341039da7..f344c99d7 100644 --- a/smack-experimental/src/main/java/org/jivesoftware/smackx/iot/data/element/NodeElement.java +++ b/smack-experimental/src/main/java/org/jivesoftware/smackx/iot/data/element/NodeElement.java @@ -50,7 +50,7 @@ public class NodeElement implements NamedElement { } @Override - public XmlStringBuilder toXML(String enclosingNamespace) { + public XmlStringBuilder toXML(org.jivesoftware.smack.packet.XmlEnvironment enclosingNamespace) { XmlStringBuilder xml = new XmlStringBuilder(this); nodeInfo.appendTo(xml); xml.rightAngleBracket(); diff --git a/smack-experimental/src/main/java/org/jivesoftware/smackx/iot/data/element/TimestampElement.java b/smack-experimental/src/main/java/org/jivesoftware/smackx/iot/data/element/TimestampElement.java index 61dc92edc..1d428b6eb 100644 --- a/smack-experimental/src/main/java/org/jivesoftware/smackx/iot/data/element/TimestampElement.java +++ b/smack-experimental/src/main/java/org/jivesoftware/smackx/iot/data/element/TimestampElement.java @@ -45,7 +45,7 @@ public class TimestampElement implements NamedElement { } @Override - public XmlStringBuilder toXML(String enclosingNamespace) { + public XmlStringBuilder toXML(org.jivesoftware.smack.packet.XmlEnvironment enclosingNamespace) { XmlStringBuilder xml = new XmlStringBuilder(this); xml.attribute("value", date); xml.rightAngleBracket(); diff --git a/smack-experimental/src/main/java/org/jivesoftware/smackx/iot/discovery/element/Tag.java b/smack-experimental/src/main/java/org/jivesoftware/smackx/iot/discovery/element/Tag.java index 01aad83d5..7709d025e 100644 --- a/smack-experimental/src/main/java/org/jivesoftware/smackx/iot/discovery/element/Tag.java +++ b/smack-experimental/src/main/java/org/jivesoftware/smackx/iot/discovery/element/Tag.java @@ -58,7 +58,7 @@ public class Tag implements NamedElement { } @Override - public XmlStringBuilder toXML(String enclosingNamespace) { + public XmlStringBuilder toXML(org.jivesoftware.smack.packet.XmlEnvironment enclosingNamespace) { XmlStringBuilder xml = new XmlStringBuilder(this); xml.attribute("name", name); xml.attribute("value", value); diff --git a/smack-experimental/src/main/java/org/jivesoftware/smackx/iot/provisioning/element/Friend.java b/smack-experimental/src/main/java/org/jivesoftware/smackx/iot/provisioning/element/Friend.java index 2f8f887e9..30ccea94b 100644 --- a/smack-experimental/src/main/java/org/jivesoftware/smackx/iot/provisioning/element/Friend.java +++ b/smack-experimental/src/main/java/org/jivesoftware/smackx/iot/provisioning/element/Friend.java @@ -45,7 +45,7 @@ public class Friend implements ExtensionElement { } @Override - public XmlStringBuilder toXML(String enclosingNamespace) { + public XmlStringBuilder toXML(org.jivesoftware.smack.packet.XmlEnvironment enclosingNamespace) { XmlStringBuilder xml = new XmlStringBuilder(this); xml.attribute("jid", friend); xml.closeEmptyElement(); diff --git a/smack-experimental/src/main/java/org/jivesoftware/smackx/iot/provisioning/element/Unfriend.java b/smack-experimental/src/main/java/org/jivesoftware/smackx/iot/provisioning/element/Unfriend.java index 29ce71810..da73304dc 100644 --- a/smack-experimental/src/main/java/org/jivesoftware/smackx/iot/provisioning/element/Unfriend.java +++ b/smack-experimental/src/main/java/org/jivesoftware/smackx/iot/provisioning/element/Unfriend.java @@ -47,7 +47,7 @@ public class Unfriend implements ExtensionElement { } @Override - public XmlStringBuilder toXML(String enclosingNamespace) { + public XmlStringBuilder toXML(org.jivesoftware.smack.packet.XmlEnvironment enclosingNamespace) { XmlStringBuilder xml = new XmlStringBuilder(this); xml.attribute("jid", jid); xml.closeEmptyElement(); diff --git a/smack-experimental/src/main/java/org/jivesoftware/smackx/jingle_filetransfer/element/Checksum.java b/smack-experimental/src/main/java/org/jivesoftware/smackx/jingle_filetransfer/element/Checksum.java index 9f252bc23..a6869e7c5 100644 --- a/smack-experimental/src/main/java/org/jivesoftware/smackx/jingle_filetransfer/element/Checksum.java +++ b/smack-experimental/src/main/java/org/jivesoftware/smackx/jingle_filetransfer/element/Checksum.java @@ -46,7 +46,7 @@ public class Checksum implements ExtensionElement { } @Override - public CharSequence toXML(String enclosingNamespace) { + public CharSequence toXML(org.jivesoftware.smack.packet.XmlEnvironment enclosingNamespace) { XmlStringBuilder sb = new XmlStringBuilder(this); sb.optAttribute(ATTR_CREATOR, creator); sb.optAttribute(ATTR_NAME, name); diff --git a/smack-experimental/src/main/java/org/jivesoftware/smackx/jingle_filetransfer/element/JingleFileTransferChild.java b/smack-experimental/src/main/java/org/jivesoftware/smackx/jingle_filetransfer/element/JingleFileTransferChild.java index 6308266ac..ffd3b51a5 100644 --- a/smack-experimental/src/main/java/org/jivesoftware/smackx/jingle_filetransfer/element/JingleFileTransferChild.java +++ b/smack-experimental/src/main/java/org/jivesoftware/smackx/jingle_filetransfer/element/JingleFileTransferChild.java @@ -86,7 +86,7 @@ public class JingleFileTransferChild extends JingleContentDescriptionChildElemen } @Override - public CharSequence toXML(String enclosingNamespace) { + public CharSequence toXML(org.jivesoftware.smack.packet.XmlEnvironment enclosingNamespace) { XmlStringBuilder sb = new XmlStringBuilder(this); sb.rightAngleBracket(); diff --git a/smack-experimental/src/main/java/org/jivesoftware/smackx/jingle_filetransfer/element/Range.java b/smack-experimental/src/main/java/org/jivesoftware/smackx/jingle_filetransfer/element/Range.java index 76dc197ce..c0366695e 100644 --- a/smack-experimental/src/main/java/org/jivesoftware/smackx/jingle_filetransfer/element/Range.java +++ b/smack-experimental/src/main/java/org/jivesoftware/smackx/jingle_filetransfer/element/Range.java @@ -99,7 +99,7 @@ public class Range implements NamedElement { } @Override - public CharSequence toXML(String enclosingNamespace) { + public CharSequence toXML(org.jivesoftware.smack.packet.XmlEnvironment enclosingNamespace) { XmlStringBuilder sb = new XmlStringBuilder(this); if (offset > 0) { @@ -133,6 +133,6 @@ public class Range implements NamedElement { @Override public int hashCode() { - return toXML(null).toString().hashCode(); + return toXML().toString().hashCode(); } } diff --git a/smack-experimental/src/main/java/org/jivesoftware/smackx/json/packet/AbstractJsonPacketExtension.java b/smack-experimental/src/main/java/org/jivesoftware/smackx/json/packet/AbstractJsonPacketExtension.java index 3df8f7251..4d395debf 100644 --- a/smack-experimental/src/main/java/org/jivesoftware/smackx/json/packet/AbstractJsonPacketExtension.java +++ b/smack-experimental/src/main/java/org/jivesoftware/smackx/json/packet/AbstractJsonPacketExtension.java @@ -32,7 +32,7 @@ public abstract class AbstractJsonPacketExtension implements ExtensionElement { } @Override - public final XmlStringBuilder toXML(String enclosingNamespace) { + public final XmlStringBuilder toXML(org.jivesoftware.smack.packet.XmlEnvironment enclosingNamespace) { XmlStringBuilder xml = new XmlStringBuilder(this); xml.rightAngleBracket(); xml.append(json); diff --git a/smack-experimental/src/main/java/org/jivesoftware/smackx/mam/element/MamElements.java b/smack-experimental/src/main/java/org/jivesoftware/smackx/mam/element/MamElements.java index 8c7732e25..7f0504611 100644 --- a/smack-experimental/src/main/java/org/jivesoftware/smackx/mam/element/MamElements.java +++ b/smack-experimental/src/main/java/org/jivesoftware/smackx/mam/element/MamElements.java @@ -126,7 +126,7 @@ public class MamElements { } @Override - public CharSequence toXML(String enclosingNamespace) { + public CharSequence toXML(org.jivesoftware.smack.packet.XmlEnvironment enclosingNamespace) { XmlStringBuilder xml = new XmlStringBuilder(); xml.halfOpenElement(this); xml.xmlnsAttribute(NAMESPACE); @@ -167,7 +167,7 @@ public class MamElements { } @Override - public CharSequence toXML(String enclosingNamespace) { + public CharSequence toXML(org.jivesoftware.smack.packet.XmlEnvironment enclosingNamespace) { XmlStringBuilder xml = new XmlStringBuilder(); xml.openElement("always"); @@ -201,7 +201,7 @@ public class MamElements { } @Override - public CharSequence toXML(String enclosingNamespace) { + public CharSequence toXML(org.jivesoftware.smack.packet.XmlEnvironment enclosingNamespace) { XmlStringBuilder xml = new XmlStringBuilder(); xml.openElement("never"); diff --git a/smack-experimental/src/main/java/org/jivesoftware/smackx/message_markup/element/BlockQuoteElement.java b/smack-experimental/src/main/java/org/jivesoftware/smackx/message_markup/element/BlockQuoteElement.java index acd4aba6a..0a8acf272 100644 --- a/smack-experimental/src/main/java/org/jivesoftware/smackx/message_markup/element/BlockQuoteElement.java +++ b/smack-experimental/src/main/java/org/jivesoftware/smackx/message_markup/element/BlockQuoteElement.java @@ -51,7 +51,7 @@ public class BlockQuoteElement implements MarkupElement.BlockLevelMarkupElement } @Override - public XmlStringBuilder toXML(String enclosingNamespace) { + public XmlStringBuilder toXML(org.jivesoftware.smack.packet.XmlEnvironment enclosingNamespace) { XmlStringBuilder xml = new XmlStringBuilder(); xml.halfOpenElement(this); xml.attribute(ATTR_START, getStart()); diff --git a/smack-experimental/src/main/java/org/jivesoftware/smackx/message_markup/element/CodeBlockElement.java b/smack-experimental/src/main/java/org/jivesoftware/smackx/message_markup/element/CodeBlockElement.java index 655155cb2..73e333af3 100644 --- a/smack-experimental/src/main/java/org/jivesoftware/smackx/message_markup/element/CodeBlockElement.java +++ b/smack-experimental/src/main/java/org/jivesoftware/smackx/message_markup/element/CodeBlockElement.java @@ -51,7 +51,7 @@ public class CodeBlockElement implements MarkupElement.BlockLevelMarkupElement { } @Override - public XmlStringBuilder toXML(String enclosingNamespace) { + public XmlStringBuilder toXML(org.jivesoftware.smack.packet.XmlEnvironment enclosingNamespace) { XmlStringBuilder xml = new XmlStringBuilder(); xml.halfOpenElement(this); xml.attribute(ATTR_START, getStart()); diff --git a/smack-experimental/src/main/java/org/jivesoftware/smackx/message_markup/element/ListElement.java b/smack-experimental/src/main/java/org/jivesoftware/smackx/message_markup/element/ListElement.java index ec3b7aa98..986d0f1f6 100644 --- a/smack-experimental/src/main/java/org/jivesoftware/smackx/message_markup/element/ListElement.java +++ b/smack-experimental/src/main/java/org/jivesoftware/smackx/message_markup/element/ListElement.java @@ -68,7 +68,7 @@ public class ListElement implements MarkupElement.MarkupChildElement { } @Override - public CharSequence toXML(String enclosingNamespace) { + public CharSequence toXML(org.jivesoftware.smack.packet.XmlEnvironment enclosingNamespace) { XmlStringBuilder xml = new XmlStringBuilder(); xml.halfOpenElement(this); xml.attribute(ATTR_START, getStart()); @@ -76,7 +76,7 @@ public class ListElement implements MarkupElement.MarkupChildElement { xml.rightAngleBracket(); for (ListEntryElement li : getEntries()) { - xml.append(li.toXML(null)); + xml.append(li.toXML()); } xml.closeElement(this); @@ -110,7 +110,7 @@ public class ListElement implements MarkupElement.MarkupChildElement { } @Override - public XmlStringBuilder toXML(String enclosingNamespace) { + public XmlStringBuilder toXML(org.jivesoftware.smack.packet.XmlEnvironment enclosingNamespace) { XmlStringBuilder xml = new XmlStringBuilder(); xml.halfOpenElement(this); xml.attribute(ATTR_START, getStart()); diff --git a/smack-experimental/src/main/java/org/jivesoftware/smackx/message_markup/element/MarkupElement.java b/smack-experimental/src/main/java/org/jivesoftware/smackx/message_markup/element/MarkupElement.java index 6088010b6..9a60073c2 100644 --- a/smack-experimental/src/main/java/org/jivesoftware/smackx/message_markup/element/MarkupElement.java +++ b/smack-experimental/src/main/java/org/jivesoftware/smackx/message_markup/element/MarkupElement.java @@ -68,11 +68,11 @@ public class MarkupElement implements ExtensionElement { } @Override - public XmlStringBuilder toXML(String enclosingNamespace) { + public XmlStringBuilder toXML(org.jivesoftware.smack.packet.XmlEnvironment enclosingNamespace) { XmlStringBuilder xml = new XmlStringBuilder(this).rightAngleBracket(); for (MarkupChildElement child : getChildElements()) { - xml.append(child.toXML(null)); + xml.append(child.toXML()); } xml.closeElement(this); diff --git a/smack-experimental/src/main/java/org/jivesoftware/smackx/message_markup/element/SpanElement.java b/smack-experimental/src/main/java/org/jivesoftware/smackx/message_markup/element/SpanElement.java index 476be80ab..013c29fbe 100644 --- a/smack-experimental/src/main/java/org/jivesoftware/smackx/message_markup/element/SpanElement.java +++ b/smack-experimental/src/main/java/org/jivesoftware/smackx/message_markup/element/SpanElement.java @@ -76,7 +76,7 @@ public class SpanElement implements MarkupElement.MarkupChildElement { } @Override - public XmlStringBuilder toXML(String enclosingNamespace) { + public XmlStringBuilder toXML(org.jivesoftware.smack.packet.XmlEnvironment enclosingNamespace) { XmlStringBuilder xml = new XmlStringBuilder(); xml.halfOpenElement(this); xml.attribute(ATTR_START, getStart()); diff --git a/smack-experimental/src/main/java/org/jivesoftware/smackx/muclight/element/MUCLightElements.java b/smack-experimental/src/main/java/org/jivesoftware/smackx/muclight/element/MUCLightElements.java index f7c2a94b6..098d10ecf 100644 --- a/smack-experimental/src/main/java/org/jivesoftware/smackx/muclight/element/MUCLightElements.java +++ b/smack-experimental/src/main/java/org/jivesoftware/smackx/muclight/element/MUCLightElements.java @@ -94,7 +94,7 @@ public abstract class MUCLightElements { } @Override - public CharSequence toXML(String enclosingNamespace) { + public CharSequence toXML(org.jivesoftware.smack.packet.XmlEnvironment enclosingNamespace) { XmlStringBuilder xml = new XmlStringBuilder(this); xml.rightAngleBracket(); @@ -208,7 +208,7 @@ public abstract class MUCLightElements { } @Override - public CharSequence toXML(String enclosingNamespace) { + public CharSequence toXML(org.jivesoftware.smack.packet.XmlEnvironment enclosingNamespace) { XmlStringBuilder xml = new XmlStringBuilder(this); xml.rightAngleBracket(); @@ -255,7 +255,7 @@ public abstract class MUCLightElements { } @Override - public CharSequence toXML(String enclosingNamespace) { + public CharSequence toXML(org.jivesoftware.smack.packet.XmlEnvironment enclosingNamespace) { XmlStringBuilder xml = new XmlStringBuilder(); xml.openElement("configuration"); @@ -296,7 +296,7 @@ public abstract class MUCLightElements { } @Override - public CharSequence toXML(String enclosingNamespace) { + public CharSequence toXML(org.jivesoftware.smack.packet.XmlEnvironment enclosingNamespace) { XmlStringBuilder xml = new XmlStringBuilder(); xml.openElement("occupants"); @@ -335,7 +335,7 @@ public abstract class MUCLightElements { } @Override - public CharSequence toXML(String enclosingNamespace) { + public CharSequence toXML(org.jivesoftware.smack.packet.XmlEnvironment enclosingNamespace) { XmlStringBuilder xml = new XmlStringBuilder(); xml.halfOpenElement("user"); xml.attribute("affiliation", affiliation); @@ -373,7 +373,7 @@ public abstract class MUCLightElements { } @Override - public CharSequence toXML(String enclosingNamespace) { + public CharSequence toXML(org.jivesoftware.smack.packet.XmlEnvironment enclosingNamespace) { XmlStringBuilder xml = new XmlStringBuilder(); String tag = isRoom ? "room" : "user"; diff --git a/smack-experimental/src/main/java/org/jivesoftware/smackx/push_notifications/element/PushNotificationsElements.java b/smack-experimental/src/main/java/org/jivesoftware/smackx/push_notifications/element/PushNotificationsElements.java index e16831afd..b258a2253 100644 --- a/smack-experimental/src/main/java/org/jivesoftware/smackx/push_notifications/element/PushNotificationsElements.java +++ b/smack-experimental/src/main/java/org/jivesoftware/smackx/push_notifications/element/PushNotificationsElements.java @@ -78,7 +78,7 @@ public class PushNotificationsElements { } @Override - public CharSequence toXML(String enclosingNamespace) { + public CharSequence toXML(org.jivesoftware.smack.packet.XmlEnvironment enclosingNamespace) { XmlStringBuilder xml = new XmlStringBuilder(this); xml.attribute("node", node); diff --git a/smack-experimental/src/main/java/org/jivesoftware/smackx/reference/element/ReferenceElement.java b/smack-experimental/src/main/java/org/jivesoftware/smackx/reference/element/ReferenceElement.java index 3d1d6e25d..902699344 100644 --- a/smack-experimental/src/main/java/org/jivesoftware/smackx/reference/element/ReferenceElement.java +++ b/smack-experimental/src/main/java/org/jivesoftware/smackx/reference/element/ReferenceElement.java @@ -174,7 +174,7 @@ public class ReferenceElement implements ExtensionElement { } @Override - public XmlStringBuilder toXML(String enclosingNamespace) { + public XmlStringBuilder toXML(org.jivesoftware.smack.packet.XmlEnvironment enclosingNamespace) { XmlStringBuilder xml = new XmlStringBuilder(this) .optIntAttribute(ATTR_BEGIN, begin != null ? begin : -1) .optIntAttribute(ATTR_END, end != null ? end : -1) @@ -186,7 +186,7 @@ public class ReferenceElement implements ExtensionElement { return xml.closeEmptyElement(); } else { return xml.rightAngleBracket() - .append(child.toXML(null)) + .append(child.toXML()) .closeElement(this); } } diff --git a/smack-experimental/src/main/java/org/jivesoftware/smackx/sid/element/OriginIdElement.java b/smack-experimental/src/main/java/org/jivesoftware/smackx/sid/element/OriginIdElement.java index 5ff30b763..b38dc5f38 100644 --- a/smack-experimental/src/main/java/org/jivesoftware/smackx/sid/element/OriginIdElement.java +++ b/smack-experimental/src/main/java/org/jivesoftware/smackx/sid/element/OriginIdElement.java @@ -76,7 +76,7 @@ public class OriginIdElement extends StableAndUniqueIdElement { } @Override - public CharSequence toXML(String enclosingNamespace) { + public CharSequence toXML(org.jivesoftware.smack.packet.XmlEnvironment enclosingNamespace) { return new XmlStringBuilder(this) .attribute(ATTR_ID, getId()) .closeEmptyElement(); diff --git a/smack-experimental/src/main/java/org/jivesoftware/smackx/sid/element/StanzaIdElement.java b/smack-experimental/src/main/java/org/jivesoftware/smackx/sid/element/StanzaIdElement.java index ca518a924..0bd2ffd22 100644 --- a/smack-experimental/src/main/java/org/jivesoftware/smackx/sid/element/StanzaIdElement.java +++ b/smack-experimental/src/main/java/org/jivesoftware/smackx/sid/element/StanzaIdElement.java @@ -72,7 +72,7 @@ public class StanzaIdElement extends StableAndUniqueIdElement { } @Override - public XmlStringBuilder toXML(String enclosingNamespace) { + public XmlStringBuilder toXML(org.jivesoftware.smack.packet.XmlEnvironment enclosingNamespace) { return new XmlStringBuilder(this) .attribute(ATTR_ID, getId()) .attribute(ATTR_BY, getBy()) diff --git a/smack-experimental/src/main/java/org/jivesoftware/smackx/spoiler/element/SpoilerElement.java b/smack-experimental/src/main/java/org/jivesoftware/smackx/spoiler/element/SpoilerElement.java index 0d3e10280..1b71b6dba 100644 --- a/smack-experimental/src/main/java/org/jivesoftware/smackx/spoiler/element/SpoilerElement.java +++ b/smack-experimental/src/main/java/org/jivesoftware/smackx/spoiler/element/SpoilerElement.java @@ -151,7 +151,7 @@ public class SpoilerElement implements ExtensionElement { } @Override - public CharSequence toXML(String enclosingNamespace) { + public CharSequence toXML(org.jivesoftware.smack.packet.XmlEnvironment enclosingNamespace) { XmlStringBuilder xml = new XmlStringBuilder(this); xml.optXmlLangAttribute(getLanguage()); if (getHint() == null) { diff --git a/smack-experimental/src/test/java/org/jivesoftware/smackx/chat_markers/MarkableExtensionTest.java b/smack-experimental/src/test/java/org/jivesoftware/smackx/chat_markers/MarkableExtensionTest.java index 16f9efb74..34b201b5e 100644 --- a/smack-experimental/src/test/java/org/jivesoftware/smackx/chat_markers/MarkableExtensionTest.java +++ b/smack-experimental/src/test/java/org/jivesoftware/smackx/chat_markers/MarkableExtensionTest.java @@ -42,18 +42,18 @@ public class MarkableExtensionTest { message.setStanzaId("message-1"); message.setBody("My lord, dispatch; read o'er these articles."); message.addExtension(ChatMarkersElements.MarkableExtension.INSTANCE); - Assert.assertEquals(markableMessageStanza, message.toXML(null).toString()); + Assert.assertEquals(markableMessageStanza, message.toXML().toString()); } @Test public void checkMarkableProvider() throws Exception { XmlPullParser parser = PacketParserUtils.getParserFor(markableExtension); MarkableExtension markableExtension1 = new MarkableProvider().parse(parser); - Assert.assertEquals(markableExtension, markableExtension1.toXML(null).toString()); + Assert.assertEquals(markableExtension, markableExtension1.toXML().toString()); Message message = PacketParserUtils.parseStanza(markableMessageStanza); MarkableExtension markableExtension2 = MarkableExtension.from(message); - Assert.assertEquals(markableExtension, markableExtension2.toXML(null).toString()); + Assert.assertEquals(markableExtension, markableExtension2.toXML().toString()); } } diff --git a/smack-experimental/src/test/java/org/jivesoftware/smackx/hashes/HashElementTest.java b/smack-experimental/src/test/java/org/jivesoftware/smackx/hashes/HashElementTest.java index dbaa57525..e67342a9e 100644 --- a/smack-experimental/src/test/java/org/jivesoftware/smackx/hashes/HashElementTest.java +++ b/smack-experimental/src/test/java/org/jivesoftware/smackx/hashes/HashElementTest.java @@ -41,10 +41,10 @@ public class HashElementTest extends SmackTestSuite { String message = "Hello World!"; HashElement element = HashManager.calculateHashElement(SHA_256, StringUtils.toUtf8Bytes(message)); String expected = "f4OxZX/x/FO5LcGBSKHWXfwtSx+j1ncoSt3SABJtkGk="; - assertEquals(expected, element.toXML(null).toString()); + assertEquals(expected, element.toXML().toString()); HashElement parsed = new HashElementProvider().parse(TestUtils.getParser(expected)); - assertEquals(expected, parsed.toXML(null).toString()); + assertEquals(expected, parsed.toXML().toString()); assertEquals(SHA_256, parsed.getAlgorithm()); assertEquals("f4OxZX/x/FO5LcGBSKHWXfwtSx+j1ncoSt3SABJtkGk=", parsed.getHashB64()); assertArrayEquals(HashManager.sha_256(message), parsed.getHash()); diff --git a/smack-experimental/src/test/java/org/jivesoftware/smackx/httpfileupload/FileTooLargeErrorCreateTest.java b/smack-experimental/src/test/java/org/jivesoftware/smackx/httpfileupload/FileTooLargeErrorCreateTest.java index 5562b8954..eb7333b6d 100644 --- a/smack-experimental/src/test/java/org/jivesoftware/smackx/httpfileupload/FileTooLargeErrorCreateTest.java +++ b/smack-experimental/src/test/java/org/jivesoftware/smackx/httpfileupload/FileTooLargeErrorCreateTest.java @@ -32,7 +32,7 @@ public class FileTooLargeErrorCreateTest { FileTooLargeError fileTooLargeError = new FileTooLargeError(20000); Assert.assertEquals(20000, fileTooLargeError.getMaxFileSize()); - Assert.assertEquals(fileTooLargeErrorExtensionExample, fileTooLargeError.toXML(null).toString()); + Assert.assertEquals(fileTooLargeErrorExtensionExample, fileTooLargeError.toXML().toString()); } diff --git a/smack-experimental/src/test/java/org/jivesoftware/smackx/mam/FiltersTest.java b/smack-experimental/src/test/java/org/jivesoftware/smackx/mam/FiltersTest.java index d6655ae4f..71aeb7e5b 100644 --- a/smack-experimental/src/test/java/org/jivesoftware/smackx/mam/FiltersTest.java +++ b/smack-experimental/src/test/java/org/jivesoftware/smackx/mam/FiltersTest.java @@ -58,7 +58,7 @@ public class FiltersTest extends MamTest { List values = new ArrayList<>(); values.add(XmppDateTime.formatXEP0082Date(date)); - assertEquals(getMamXMemberWith(fields, values), dataForm.toXML(null).toString()); + assertEquals(getMamXMemberWith(fields, values), dataForm.toXML().toString()); } @Test @@ -73,7 +73,7 @@ public class FiltersTest extends MamTest { List values = new ArrayList<>(); values.add(XmppDateTime.formatXEP0082Date(date)); - assertEquals(getMamXMemberWith(fields, values), dataForm.toXML(null).toString()); + assertEquals(getMamXMemberWith(fields, values), dataForm.toXML().toString()); } @Test @@ -88,7 +88,7 @@ public class FiltersTest extends MamTest { List values = new ArrayList<>(); values.add(jid); - assertEquals(getMamXMemberWith(fields, values), dataForm.toXML(null).toString()); + assertEquals(getMamXMemberWith(fields, values), dataForm.toXML().toString()); } } diff --git a/smack-experimental/src/test/java/org/jivesoftware/smackx/mam/RetrieveFormFieldsTest.java b/smack-experimental/src/test/java/org/jivesoftware/smackx/mam/RetrieveFormFieldsTest.java index 8e0557b85..dad68bc0f 100644 --- a/smack-experimental/src/test/java/org/jivesoftware/smackx/mam/RetrieveFormFieldsTest.java +++ b/smack-experimental/src/test/java/org/jivesoftware/smackx/mam/RetrieveFormFieldsTest.java @@ -64,7 +64,7 @@ public class RetrieveFormFieldsTest extends MamTest { .build(); DataForm dataForm = mamQueryArgs.getDataForm(); - String dataFormResult = dataForm.toXML(null).toString(); + String dataFormResult = dataForm.toXML().toString(); assertXmlSimilar(additionalFieldsStanza, dataFormResult); } diff --git a/smack-experimental/src/test/java/org/jivesoftware/smackx/message_markup/MessageMarkupTest.java b/smack-experimental/src/test/java/org/jivesoftware/smackx/message_markup/MessageMarkupTest.java index 5c79c7aff..7afcdc6e7 100644 --- a/smack-experimental/src/test/java/org/jivesoftware/smackx/message_markup/MessageMarkupTest.java +++ b/smack-experimental/src/test/java/org/jivesoftware/smackx/message_markup/MessageMarkupTest.java @@ -45,7 +45,7 @@ public class MessageMarkupTest extends SmackTestSuite { ""; MarkupElement.Builder m = MarkupElement.getBuilder(); m.setEmphasis(9, 15); - assertXMLEqual(xml, m.build().toXML(null).toString()); + assertXMLEqual(xml, m.build().toXML().toString()); XmlPullParser parser = TestUtils.getParser(xml); MarkupElement parsed = new MarkupElementProvider().parse(parser); @@ -69,7 +69,7 @@ public class MessageMarkupTest extends SmackTestSuite { ""; MarkupElement.Builder m = MarkupElement.getBuilder(); m.setCode(9, 15); - assertXMLEqual(xml, m.build().toXML(null).toString()); + assertXMLEqual(xml, m.build().toXML().toString()); XmlPullParser parser = TestUtils.getParser(xml); MarkupElement parsed = new MarkupElementProvider().parse(parser); @@ -93,7 +93,7 @@ public class MessageMarkupTest extends SmackTestSuite { ""; MarkupElement.Builder m = MarkupElement.getBuilder(); m.setDeleted(9, 15); - assertXMLEqual(xml, m.build().toXML(null).toString()); + assertXMLEqual(xml, m.build().toXML().toString()); XmlPullParser parser = TestUtils.getParser(xml); MarkupElement parsed = new MarkupElementProvider().parse(parser); @@ -127,7 +127,7 @@ public class MessageMarkupTest extends SmackTestSuite { ""; MarkupElement.Builder m = MarkupElement.getBuilder(); m.setCodeBlock(23, 48); - assertXMLEqual(xml, m.build().toXML(null).toString()); + assertXMLEqual(xml, m.build().toXML().toString()); XmlPullParser parser = TestUtils.getParser(xml); MarkupElement parsed = new MarkupElementProvider().parse(parser); @@ -157,7 +157,7 @@ public class MessageMarkupTest extends SmackTestSuite { .addEntry(61, 69) .addEntry(69, 89) .endList(); - assertXMLEqual(xml, m.build().toXML(null).toString()); + assertXMLEqual(xml, m.build().toXML().toString()); XmlPullParser parser = TestUtils.getParser(xml); MarkupElement parsed = new MarkupElementProvider().parse(parser); @@ -186,7 +186,7 @@ public class MessageMarkupTest extends SmackTestSuite { ""; MarkupElement.Builder m = MarkupElement.getBuilder(); m.setBlockQuote(9 ,32); - assertXMLEqual(xml, m.build().toXML(null).toString()); + assertXMLEqual(xml, m.build().toXML().toString()); XmlPullParser parser = TestUtils.getParser(xml); MarkupElement parsed = new MarkupElementProvider().parse(parser); @@ -208,7 +208,7 @@ public class MessageMarkupTest extends SmackTestSuite { MarkupElement.Builder m = MarkupElement.getBuilder(); m.setBlockQuote(0, 57); m.setBlockQuote(11, 34); - assertXMLEqual(xml, m.build().toXML(null).toString()); + assertXMLEqual(xml, m.build().toXML().toString()); XmlPullParser parser = TestUtils.getParser(xml); MarkupElement parsed = new MarkupElementProvider().parse(parser); diff --git a/smack-experimental/src/test/java/org/jivesoftware/smackx/muclight/MUCLightConfigurationsChangeExtensionTest.java b/smack-experimental/src/test/java/org/jivesoftware/smackx/muclight/MUCLightConfigurationsChangeExtensionTest.java index ae52ddf8a..f03152bd1 100644 --- a/smack-experimental/src/test/java/org/jivesoftware/smackx/muclight/MUCLightConfigurationsChangeExtensionTest.java +++ b/smack-experimental/src/test/java/org/jivesoftware/smackx/muclight/MUCLightConfigurationsChangeExtensionTest.java @@ -51,7 +51,7 @@ public class MUCLightConfigurationsChangeExtensionTest { Assert.assertEquals("To be or not to be?", configurationsChangeExtension.getSubject()); Assert.assertNull(configurationsChangeExtension.getRoomName()); Assert.assertNull(configurationsChangeExtension.getCustomConfigs()); - Assert.assertEquals(messageWithSubjectChangeExample, configurationsMessage.toXML(null).toString()); + Assert.assertEquals(messageWithSubjectChangeExample, configurationsMessage.toXML().toString()); } @Test @@ -65,7 +65,7 @@ public class MUCLightConfigurationsChangeExtensionTest { Assert.assertEquals("A Darker Cave", configurationsChangeExtension.getRoomName()); Assert.assertNull(configurationsChangeExtension.getSubject()); Assert.assertNull(configurationsChangeExtension.getCustomConfigs()); - Assert.assertEquals(messageWithRoomNameChangeExample, configurationsMessage.toXML(null).toString()); + Assert.assertEquals(messageWithRoomNameChangeExample, configurationsMessage.toXML().toString()); } @Test @@ -79,7 +79,7 @@ public class MUCLightConfigurationsChangeExtensionTest { Assert.assertEquals("A Darker Cave", configurationsChangeExtension.getRoomName()); Assert.assertNull(configurationsChangeExtension.getSubject()); Assert.assertEquals("blue", configurationsChangeExtension.getCustomConfigs().get("color")); - Assert.assertEquals(messageWithConfigsChangeExample, configurationsMessage.toXML(null).toString()); + Assert.assertEquals(messageWithConfigsChangeExample, configurationsMessage.toXML().toString()); } } diff --git a/smack-experimental/src/test/java/org/jivesoftware/smackx/reference/ReferenceTest.java b/smack-experimental/src/test/java/org/jivesoftware/smackx/reference/ReferenceTest.java index 4860b5ada..1e1eb6158 100644 --- a/smack-experimental/src/test/java/org/jivesoftware/smackx/reference/ReferenceTest.java +++ b/smack-experimental/src/test/java/org/jivesoftware/smackx/reference/ReferenceTest.java @@ -41,7 +41,7 @@ public class ReferenceTest extends SmackTestSuite { "uri='xmpp:juliet@capulet.lit' />"; URI uri = new URI("xmpp:juliet@capulet.lit"); ReferenceElement element = new ReferenceElement(72, 78, ReferenceElement.Type.mention, null, uri); - assertXMLEqual(xml, element.toXML(null).toString()); + assertXMLEqual(xml, element.toXML().toString()); assertEquals(72, (int) element.getBegin()); assertEquals(78, (int) element.getEnd()); assertEquals(ReferenceElement.Type.mention, element.getType()); @@ -49,7 +49,7 @@ public class ReferenceTest extends SmackTestSuite { assertEquals(uri, element.getUri()); ReferenceElement parsed = ReferenceProvider.TEST_PROVIDER.parse(TestUtils.getParser(xml)); - assertXMLEqual(xml, parsed.toXML(null).toString()); + assertXMLEqual(xml, parsed.toXML().toString()); } /** @@ -64,7 +64,7 @@ public class ReferenceTest extends SmackTestSuite { "uri='xmpp:fdp.shakespeare.lit?;node=fdp/submitted/stan.isode.net/accidentreport;item=ndina872be' />"; URI uri = new URI("xmpp:fdp.shakespeare.lit?;node=fdp/submitted/stan.isode.net/accidentreport;item=ndina872be"); ReferenceElement element = new ReferenceElement(null, null, ReferenceElement.Type.data, null, uri); - assertXMLEqual(xml, element.toXML(null).toString()); + assertXMLEqual(xml, element.toXML().toString()); assertNull(element.getBegin()); assertNull(element.getEnd()); @@ -73,7 +73,7 @@ public class ReferenceTest extends SmackTestSuite { assertEquals(uri, element.getUri()); ReferenceElement parsed = ReferenceProvider.TEST_PROVIDER.parse(TestUtils.getParser(xml)); - assertXMLEqual(xml, parsed.toXML(null).toString()); + assertXMLEqual(xml, parsed.toXML().toString()); } @Test(expected = IllegalArgumentException.class) diff --git a/smack-experimental/src/test/java/org/jivesoftware/smackx/sid/StableUniqueStanzaIdTest.java b/smack-experimental/src/test/java/org/jivesoftware/smackx/sid/StableUniqueStanzaIdTest.java index f6486ee43..cf8ca2f33 100644 --- a/smack-experimental/src/test/java/org/jivesoftware/smackx/sid/StableUniqueStanzaIdTest.java +++ b/smack-experimental/src/test/java/org/jivesoftware/smackx/sid/StableUniqueStanzaIdTest.java @@ -40,7 +40,7 @@ public class StableUniqueStanzaIdTest extends SmackTestSuite { StanzaIdElement element = new StanzaIdElement("de305d54-75b4-431b-adb2-eb6b9e546013", "alice@wonderland.lit"); assertEquals("de305d54-75b4-431b-adb2-eb6b9e546013", element.getId()); assertEquals("alice@wonderland.lit", element.getBy()); - assertXMLEqual(xml, element.toXML(null).toString()); + assertXMLEqual(xml, element.toXML().toString()); StanzaIdElement parsed = StanzaIdProvider.TEST_INSTANCE.parse(TestUtils.getParser(xml)); assertEquals(element.getId(), parsed.getId()); @@ -52,7 +52,7 @@ public class StableUniqueStanzaIdTest extends SmackTestSuite { String xml = ""; OriginIdElement element = new OriginIdElement("de305d54-75b4-431b-adb2-eb6b9e546013"); assertEquals("de305d54-75b4-431b-adb2-eb6b9e546013", element.getId()); - assertXMLEqual(xml, element.toXML(null).toString()); + assertXMLEqual(xml, element.toXML().toString()); OriginIdElement parsed = OriginIdProvider.TEST_INSTANCE.parse(TestUtils.getParser(xml)); assertEquals(element.getId(), parsed.getId()); diff --git a/smack-experimental/src/test/java/org/jivesoftware/smackx/spoiler/SpoilerTest.java b/smack-experimental/src/test/java/org/jivesoftware/smackx/spoiler/SpoilerTest.java index 6939727f3..d20ad6082 100644 --- a/smack-experimental/src/test/java/org/jivesoftware/smackx/spoiler/SpoilerTest.java +++ b/smack-experimental/src/test/java/org/jivesoftware/smackx/spoiler/SpoilerTest.java @@ -46,11 +46,11 @@ public class SpoilerTest extends SmackTestSuite { assertNull(empty.getHint()); assertNull(empty.getLanguage()); - assertXMLEqual(xml, empty.toXML(null).toString()); + assertXMLEqual(xml, empty.toXML().toString()); XmlPullParser parser = TestUtils.getParser(xml); SpoilerElement parsed = SpoilerProvider.INSTANCE.parse(parser); - assertXMLEqual(xml, parsed.toXML(null).toString()); + assertXMLEqual(xml, parsed.toXML().toString()); } @Test @@ -65,12 +65,12 @@ public class SpoilerTest extends SmackTestSuite { assertEquals("Love story end", withHint.getHint()); assertNull(withHint.getLanguage()); - assertXMLEqual(xml, withHint.toXML(null).toString()); + assertXMLEqual(xml, withHint.toXML().toString()); XmlPullParser parser = TestUtils.getParser(xml); SpoilerElement parsed = SpoilerProvider.INSTANCE.parse(parser); - assertXMLEqual(xml, parsed.toXML(null).toString()); + assertXMLEqual(xml, parsed.toXML().toString()); } @Test @@ -85,13 +85,13 @@ public class SpoilerTest extends SmackTestSuite { assertEquals("Der Kuchen ist eine Lüge!", i18nHint.getHint()); assertEquals("de", i18nHint.getLanguage()); - assertXMLEqual(xml, i18nHint.toXML(null).toString()); + assertXMLEqual(xml, i18nHint.toXML().toString()); XmlPullParser parser = TestUtils.getParser(xml); SpoilerElement parsed = SpoilerProvider.INSTANCE.parse(parser); assertEquals(i18nHint.getLanguage(), parsed.getLanguage()); - assertXMLEqual(xml, parsed.toXML(null).toString()); + assertXMLEqual(xml, parsed.toXML().toString()); } @Test diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/address/MultipleRecipientManager.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/address/MultipleRecipientManager.java index e465a2deb..1efb36b48 100644 --- a/smack-extensions/src/main/java/org/jivesoftware/smackx/address/MultipleRecipientManager.java +++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/address/MultipleRecipientManager.java @@ -211,19 +211,19 @@ public class MultipleRecipientManager { if (to != null) { for (Jid jid : to) { packet.setTo(jid); - connection.sendStanza(new PacketCopy(packet.toXML(null))); + connection.sendStanza(new PacketCopy(packet.toXML())); } } if (cc != null) { for (Jid jid : cc) { packet.setTo(jid); - connection.sendStanza(new PacketCopy(packet.toXML(null))); + connection.sendStanza(new PacketCopy(packet.toXML())); } } if (bcc != null) { for (Jid jid : bcc) { packet.setTo(jid); - connection.sendStanza(new PacketCopy(packet.toXML(null))); + connection.sendStanza(new PacketCopy(packet.toXML())); } } } @@ -309,13 +309,13 @@ public class MultipleRecipientManager { } @Override - public CharSequence toXML(String enclosingNamespace) { + public CharSequence toXML(org.jivesoftware.smack.packet.XmlEnvironment enclosingNamespace) { return text; } @Override public String toString() { - return toXML(null).toString(); + return toXML().toString(); } } diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/address/packet/MultipleAddresses.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/address/packet/MultipleAddresses.java index c830b1e1b..2ec8cd3d7 100644 --- a/smack-extensions/src/main/java/org/jivesoftware/smackx/address/packet/MultipleAddresses.java +++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/address/packet/MultipleAddresses.java @@ -118,12 +118,12 @@ public class MultipleAddresses implements ExtensionElement { } @Override - public XmlStringBuilder toXML(String enclosingNamespace) { + public XmlStringBuilder toXML(org.jivesoftware.smack.packet.XmlEnvironment enclosingNamespace) { XmlStringBuilder buf = new XmlStringBuilder(this); buf.rightAngleBracket(); // Loop through all the addresses and append them to the string buffer for (Address address : addresses) { - buf.append(address.toXML(null)); + buf.append(address.toXML()); } buf.closeElement(this); return buf; @@ -194,7 +194,7 @@ public class MultipleAddresses implements ExtensionElement { } @Override - public XmlStringBuilder toXML(String enclosingNamespace) { + public XmlStringBuilder toXML(org.jivesoftware.smack.packet.XmlEnvironment enclosingNamespace) { XmlStringBuilder buf = new XmlStringBuilder(); buf.halfOpenElement(this).attribute("type", type); buf.optAttribute("jid", jid); diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/amp/packet/AMPExtension.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/amp/packet/AMPExtension.java index c417fe9dc..e5766dfd9 100644 --- a/smack-extensions/src/main/java/org/jivesoftware/smackx/amp/packet/AMPExtension.java +++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/amp/packet/AMPExtension.java @@ -154,7 +154,7 @@ public class AMPExtension implements ExtensionElement { * Returns the XML representation of a XHTML extension according the specification. **/ @Override - public String toXML(String enclosingNamespace) { + public String toXML(org.jivesoftware.smack.packet.XmlEnvironment enclosingNamespace) { StringBuilder buf = new StringBuilder(); buf.append('<').append(getElementName()).append(" xmlns=\"").append(getNamespace()).append('"'); if (status != null) { diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/attention/packet/AttentionExtension.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/attention/packet/AttentionExtension.java index 103c5fb6d..874a765ee 100644 --- a/smack-extensions/src/main/java/org/jivesoftware/smackx/attention/packet/AttentionExtension.java +++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/attention/packet/AttentionExtension.java @@ -69,7 +69,7 @@ public class AttentionExtension implements ExtensionElement { * @see org.jivesoftware.smack.packet.PacketExtension#toXML() */ @Override - public String toXML(String enclosingNamespace) { + public String toXML(org.jivesoftware.smack.packet.XmlEnvironment enclosingNamespace) { final StringBuilder sb = new StringBuilder(); sb.append('<').append(getElementName()).append(" xmlns=\"").append( getNamespace()).append("\"/>"); diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/blocking/element/BlockedErrorExtension.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/blocking/element/BlockedErrorExtension.java index 84ffee568..a01c83d99 100644 --- a/smack-extensions/src/main/java/org/jivesoftware/smackx/blocking/element/BlockedErrorExtension.java +++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/blocking/element/BlockedErrorExtension.java @@ -46,7 +46,7 @@ public class BlockedErrorExtension implements ExtensionElement { } @Override - public CharSequence toXML(String enclosingNamespace) { + public CharSequence toXML(org.jivesoftware.smack.packet.XmlEnvironment enclosingNamespace) { XmlStringBuilder xml = new XmlStringBuilder(this); xml.closeEmptyElement(); return xml; diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/bob/element/BoBExtension.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/bob/element/BoBExtension.java index 967b52100..58c9cb2df 100644 --- a/smack-extensions/src/main/java/org/jivesoftware/smackx/bob/element/BoBExtension.java +++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/bob/element/BoBExtension.java @@ -68,7 +68,7 @@ public class BoBExtension extends XHTMLExtension { } @Override - public XmlStringBuilder toXML(String enclosingNamespace) { + public XmlStringBuilder toXML(org.jivesoftware.smack.packet.XmlEnvironment enclosingNamespace) { XmlStringBuilder xml = new XmlStringBuilder(this); xml.rightAngleBracket(); diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/bytestreams/ibb/packet/DataPacketExtension.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/bytestreams/ibb/packet/DataPacketExtension.java index d27f27221..e7d274739 100644 --- a/smack-extensions/src/main/java/org/jivesoftware/smackx/bytestreams/ibb/packet/DataPacketExtension.java +++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/bytestreams/ibb/packet/DataPacketExtension.java @@ -137,7 +137,7 @@ public class DataPacketExtension implements ExtensionElement { } @Override - public XmlStringBuilder toXML(String enclosingNamespace) { + public XmlStringBuilder toXML(org.jivesoftware.smack.packet.XmlEnvironment enclosingNamespace) { XmlStringBuilder xml = getIQChildElementBuilder(new IQChildElementXmlStringBuilder(this)); xml.closeElement(this); return xml; diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/bytestreams/socks5/packet/Bytestream.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/bytestreams/socks5/packet/Bytestream.java index 4cf6d2d7d..0ea6019af 100644 --- a/smack-extensions/src/main/java/org/jivesoftware/smackx/bytestreams/socks5/packet/Bytestream.java +++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/bytestreams/socks5/packet/Bytestream.java @@ -232,11 +232,11 @@ public class Bytestream extends IQ { xml.rightAngleBracket(); if (getToActivate() == null) { for (StreamHost streamHost : getStreamHosts()) { - xml.append(streamHost.toXML(null)); + xml.append(streamHost.toXML()); } } else { - xml.append(getToActivate().toXML(null)); + xml.append(getToActivate().toXML()); } break; case result: @@ -246,7 +246,7 @@ public class Bytestream extends IQ { // constructions mechanisms of Bytestream // A result from the server can also contain stream hosts for (StreamHost host : streamHosts) { - xml.append(host.toXML(null)); + xml.append(host.toXML()); } break; case get: @@ -325,7 +325,7 @@ public class Bytestream extends IQ { } @Override - public XmlStringBuilder toXML(String enclosingNamespace) { + public XmlStringBuilder toXML(org.jivesoftware.smack.packet.XmlEnvironment enclosingNamespace) { XmlStringBuilder xml = new XmlStringBuilder(this); xml.attribute("jid", getJID()); xml.attribute("host", getAddress()); @@ -375,7 +375,7 @@ public class Bytestream extends IQ { } @Override - public XmlStringBuilder toXML(String enclosingNamespace) { + public XmlStringBuilder toXML(org.jivesoftware.smack.packet.XmlEnvironment enclosingNamespace) { XmlStringBuilder xml = new XmlStringBuilder(this); xml.attribute("jid", getJID()); xml.closeEmptyElement(); @@ -418,7 +418,7 @@ public class Bytestream extends IQ { } @Override - public XmlStringBuilder toXML(String enclosingNamespace) { + public XmlStringBuilder toXML(org.jivesoftware.smack.packet.XmlEnvironment enclosingNamespace) { XmlStringBuilder xml = new XmlStringBuilder(this); xml.rightAngleBracket(); xml.escape(getTarget()); diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/caps/cache/SimpleDirectoryPersistentCache.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/caps/cache/SimpleDirectoryPersistentCache.java index 18ce9b8ac..bc5cd163c 100644 --- a/smack-extensions/src/main/java/org/jivesoftware/smackx/caps/cache/SimpleDirectoryPersistentCache.java +++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/caps/cache/SimpleDirectoryPersistentCache.java @@ -131,7 +131,7 @@ public class SimpleDirectoryPersistentCache implements EntityCapsPersistentCache */ private static void writeInfoToFile(File file, DiscoverInfo info) throws IOException { try (DataOutputStream dos = new DataOutputStream(new FileOutputStream(file))) { - dos.writeUTF(info.toXML(null).toString()); + dos.writeUTF(info.toXML().toString()); } } diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/caps/packet/CapsExtension.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/caps/packet/CapsExtension.java index 56405bef4..7ebaea5be 100644 --- a/smack-extensions/src/main/java/org/jivesoftware/smackx/caps/packet/CapsExtension.java +++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/caps/packet/CapsExtension.java @@ -69,7 +69,7 @@ public class CapsExtension implements ExtensionElement { * */ @Override - public XmlStringBuilder toXML(String enclosingNamespace) { + public XmlStringBuilder toXML(org.jivesoftware.smack.packet.XmlEnvironment enclosingNamespace) { XmlStringBuilder xml = new XmlStringBuilder(this); xml.attribute("hash", hash).attribute("node", node).attribute("ver", ver); xml.closeEmptyElement(); diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/chatstates/packet/ChatStateExtension.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/chatstates/packet/ChatStateExtension.java index 745108b66..eb7e5ff1d 100644 --- a/smack-extensions/src/main/java/org/jivesoftware/smackx/chatstates/packet/ChatStateExtension.java +++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/chatstates/packet/ChatStateExtension.java @@ -59,7 +59,7 @@ public class ChatStateExtension implements ExtensionElement { } @Override - public XmlStringBuilder toXML(String enclosingNamespace) { + public XmlStringBuilder toXML(org.jivesoftware.smack.packet.XmlEnvironment enclosingNamespace) { XmlStringBuilder xml = new XmlStringBuilder(this); xml.closeEmptyElement(); return xml; diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/commands/packet/AdHocCommandData.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/commands/packet/AdHocCommandData.java index e25154811..38bbc966a 100755 --- a/smack-extensions/src/main/java/org/jivesoftware/smackx/commands/packet/AdHocCommandData.java +++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/commands/packet/AdHocCommandData.java @@ -95,7 +95,7 @@ public class AdHocCommandData extends IQ { } if (form != null) { - xml.append(form.toXML(null)); + xml.append(form.toXML()); } for (AdHocCommandNote note : notes) { @@ -264,7 +264,7 @@ public class AdHocCommandData extends IQ { } @Override - public String toXML(String enclosingNamespace) { + public String toXML(org.jivesoftware.smack.packet.XmlEnvironment enclosingNamespace) { StringBuilder buf = new StringBuilder(); buf.append('<').append(getElementName()); buf.append(" xmlns=\"").append(getNamespace()).append("\"/>"); diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/delay/packet/DelayInformation.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/delay/packet/DelayInformation.java index 6fe3c4de6..71db396b6 100644 --- a/smack-extensions/src/main/java/org/jivesoftware/smackx/delay/packet/DelayInformation.java +++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/delay/packet/DelayInformation.java @@ -102,7 +102,7 @@ public class DelayInformation implements ExtensionElement { } @Override - public XmlStringBuilder toXML(String enclosingNamespace) { + public XmlStringBuilder toXML(org.jivesoftware.smack.packet.XmlEnvironment enclosingNamespace) { XmlStringBuilder xml = new XmlStringBuilder(this); xml.attribute("stamp", XmppDateTime.formatXEP0082Date(stamp)); xml.optAttribute("from", from); diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/forward/packet/Forwarded.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/forward/packet/Forwarded.java index edc1fbd13..17ebf299c 100644 --- a/smack-extensions/src/main/java/org/jivesoftware/smackx/forward/packet/Forwarded.java +++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/forward/packet/Forwarded.java @@ -71,7 +71,7 @@ public class Forwarded implements ExtensionElement { } @Override - public XmlStringBuilder toXML(String enclosingNamespace) { + public XmlStringBuilder toXML(org.jivesoftware.smack.packet.XmlEnvironment enclosingNamespace) { XmlStringBuilder xml = new XmlStringBuilder(this); xml.rightAngleBracket(); xml.optElement(getDelayInformation()); diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/geoloc/packet/GeoLocation.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/geoloc/packet/GeoLocation.java index 083e59fa8..3abc3c334 100644 --- a/smack-extensions/src/main/java/org/jivesoftware/smackx/geoloc/packet/GeoLocation.java +++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/geoloc/packet/GeoLocation.java @@ -214,7 +214,7 @@ public final class GeoLocation implements Serializable, ExtensionElement { } @Override - public CharSequence toXML(String enclosingNamespace) { + public CharSequence toXML(org.jivesoftware.smack.packet.XmlEnvironment enclosingNamespace) { XmlStringBuilder xml = new XmlStringBuilder(this); xml.rightAngleBracket(); xml.optElement("accuracy", accuracy); diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/iqregister/packet/Registration.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/iqregister/packet/Registration.java index 06548ce58..039658016 100644 --- a/smack-extensions/src/main/java/org/jivesoftware/smackx/iqregister/packet/Registration.java +++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/iqregister/packet/Registration.java @@ -115,7 +115,7 @@ public class Registration extends IQ { } @Override - public CharSequence toXML(String enclosingNamespace) { + public CharSequence toXML(org.jivesoftware.smack.packet.XmlEnvironment enclosingNamespace) { return '<' + ELEMENT + " xmlns='" + NAMESPACE + "'/>"; } diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/jingle/element/JingleContent.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/jingle/element/JingleContent.java index 828fcc5e9..c88978828 100644 --- a/smack-extensions/src/main/java/org/jivesoftware/smackx/jingle/element/JingleContent.java +++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/jingle/element/JingleContent.java @@ -132,7 +132,7 @@ public final class JingleContent implements NamedElement { } @Override - public XmlStringBuilder toXML(String enclosingNamespace) { + public XmlStringBuilder toXML(org.jivesoftware.smack.packet.XmlEnvironment enclosingNamespace) { XmlStringBuilder xml = new XmlStringBuilder(this); xml.attribute(CREATOR_ATTRIBUTE_NAME, creator); xml.optAttribute(DISPOSITION_ATTRIBUTE_NAME, disposition); diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/jingle/element/JingleContentDescription.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/jingle/element/JingleContentDescription.java index f37220f0e..a26e303d8 100644 --- a/smack-extensions/src/main/java/org/jivesoftware/smackx/jingle/element/JingleContentDescription.java +++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/jingle/element/JingleContentDescription.java @@ -56,7 +56,7 @@ public abstract class JingleContentDescription implements ExtensionElement { } @Override - public XmlStringBuilder toXML(String enclosingNamespace) { + public XmlStringBuilder toXML(org.jivesoftware.smack.packet.XmlEnvironment enclosingNamespace) { XmlStringBuilder xml = new XmlStringBuilder(this); addExtraAttributes(xml); xml.rightAngleBracket(); diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/jingle/element/JingleContentTransport.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/jingle/element/JingleContentTransport.java index e21b4c348..f3580540a 100644 --- a/smack-extensions/src/main/java/org/jivesoftware/smackx/jingle/element/JingleContentTransport.java +++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/jingle/element/JingleContentTransport.java @@ -66,7 +66,7 @@ public abstract class JingleContentTransport implements ExtensionElement { } @Override - public XmlStringBuilder toXML(String enclosingNamespace) { + public XmlStringBuilder toXML(org.jivesoftware.smack.packet.XmlEnvironment enclosingNamespace) { XmlStringBuilder xml = new XmlStringBuilder(this); addExtraAttributes(xml); diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/jingle/element/JingleError.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/jingle/element/JingleError.java index 65735d0b6..2931973ee 100644 --- a/smack-extensions/src/main/java/org/jivesoftware/smackx/jingle/element/JingleError.java +++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/jingle/element/JingleError.java @@ -55,7 +55,7 @@ public final class JingleError implements ExtensionElement { } @Override - public XmlStringBuilder toXML(String enclosingNamespace) { + public XmlStringBuilder toXML(org.jivesoftware.smack.packet.XmlEnvironment enclosingNamespace) { XmlStringBuilder xml = new XmlStringBuilder(this); xml.closeEmptyElement(); return xml; diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/jingle/element/JingleReason.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/jingle/element/JingleReason.java index 7aeb84be6..e4d601aea 100644 --- a/smack-extensions/src/main/java/org/jivesoftware/smackx/jingle/element/JingleReason.java +++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/jingle/element/JingleReason.java @@ -114,7 +114,7 @@ public class JingleReason implements NamedElement { } @Override - public XmlStringBuilder toXML(String enclosingNamespace) { + public XmlStringBuilder toXML(org.jivesoftware.smack.packet.XmlEnvironment enclosingNamespace) { XmlStringBuilder xml = new XmlStringBuilder(this); xml.rightAngleBracket(); @@ -143,7 +143,7 @@ public class JingleReason implements NamedElement { } @Override - public XmlStringBuilder toXML(String enclosingNamespace) { + public XmlStringBuilder toXML(org.jivesoftware.smack.packet.XmlEnvironment enclosingNamespace) { XmlStringBuilder xml = new XmlStringBuilder(this); xml.rightAngleBracket(); diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/jingle/element/UnknownJingleContentDescription.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/jingle/element/UnknownJingleContentDescription.java index 67518d381..c735e84d6 100644 --- a/smack-extensions/src/main/java/org/jivesoftware/smackx/jingle/element/UnknownJingleContentDescription.java +++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/jingle/element/UnknownJingleContentDescription.java @@ -1,6 +1,6 @@ /** * - * Copyright 2017 Florian Schmaus. + * Copyright 2017-2019 Florian Schmaus. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -17,6 +17,7 @@ package org.jivesoftware.smackx.jingle.element; import org.jivesoftware.smack.packet.StandardExtensionElement; +import org.jivesoftware.smack.packet.XmlEnvironment; import org.jivesoftware.smack.util.XmlStringBuilder; public final class UnknownJingleContentDescription extends JingleContentDescription { @@ -39,8 +40,8 @@ public final class UnknownJingleContentDescription extends JingleContentDescript } @Override - public XmlStringBuilder toXML(String enclosingNamespace) { - return standardExtensionElement.toXML(null); + public XmlStringBuilder toXML(XmlEnvironment enclosingXmlEnvironment) { + return standardExtensionElement.toXML(enclosingXmlEnvironment); } public StandardExtensionElement getStandardExtensionElement() { diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/jingle/element/UnknownJingleContentTransport.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/jingle/element/UnknownJingleContentTransport.java index d4d760daf..83efcae5f 100644 --- a/smack-extensions/src/main/java/org/jivesoftware/smackx/jingle/element/UnknownJingleContentTransport.java +++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/jingle/element/UnknownJingleContentTransport.java @@ -1,6 +1,6 @@ /** * - * Copyright 2017 Florian Schmaus. + * Copyright 2017-2019 Florian Schmaus. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -19,6 +19,7 @@ package org.jivesoftware.smackx.jingle.element; import java.util.List; import org.jivesoftware.smack.packet.StandardExtensionElement; +import org.jivesoftware.smack.packet.XmlEnvironment; import org.jivesoftware.smack.util.XmlStringBuilder; public final class UnknownJingleContentTransport extends JingleContentTransport { @@ -41,8 +42,8 @@ public final class UnknownJingleContentTransport extends JingleContentTransport } @Override - public XmlStringBuilder toXML(String enclosingNamespace) { - return standardExtensionElement.toXML(null); + public XmlStringBuilder toXML(XmlEnvironment enclosingXmlEnvironment) { + return standardExtensionElement.toXML(enclosingXmlEnvironment); } @Override diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/jingle/transports/jingle_ibb/element/JingleIBBTransport.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/jingle/transports/jingle_ibb/element/JingleIBBTransport.java index 981b6d9cf..656db54a3 100644 --- a/smack-extensions/src/main/java/org/jivesoftware/smackx/jingle/transports/jingle_ibb/element/JingleIBBTransport.java +++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/jingle/transports/jingle_ibb/element/JingleIBBTransport.java @@ -92,6 +92,6 @@ public class JingleIBBTransport extends JingleContentTransport { @Override public int hashCode() { - return this.toXML(null).toString().hashCode(); + return this.toXML().toString().hashCode(); } } diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/jingle/transports/jingle_s5b/elements/JingleS5BTransportCandidate.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/jingle/transports/jingle_s5b/elements/JingleS5BTransportCandidate.java index 03fc04680..67f5562ee 100644 --- a/smack-extensions/src/main/java/org/jivesoftware/smackx/jingle/transports/jingle_s5b/elements/JingleS5BTransportCandidate.java +++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/jingle/transports/jingle_s5b/elements/JingleS5BTransportCandidate.java @@ -130,7 +130,7 @@ public final class JingleS5BTransportCandidate extends JingleContentTransportCan } @Override - public CharSequence toXML(String enclosingNamespace) { + public CharSequence toXML(org.jivesoftware.smack.packet.XmlEnvironment enclosingNamespace) { XmlStringBuilder xml = new XmlStringBuilder(); xml.halfOpenElement(this); xml.attribute(ATTR_CID, cid); diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/jingle/transports/jingle_s5b/elements/JingleS5BTransportInfo.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/jingle/transports/jingle_s5b/elements/JingleS5BTransportInfo.java index 95c6407cc..8ca592144 100644 --- a/smack-extensions/src/main/java/org/jivesoftware/smackx/jingle/transports/jingle_s5b/elements/JingleS5BTransportInfo.java +++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/jingle/transports/jingle_s5b/elements/JingleS5BTransportInfo.java @@ -38,7 +38,7 @@ public abstract class JingleS5BTransportInfo extends JingleContentTransportInfo } @Override - public final XmlStringBuilder toXML(String enclosingNamespace) { + public final XmlStringBuilder toXML(org.jivesoftware.smack.packet.XmlEnvironment enclosingNamespace) { XmlStringBuilder xml = new XmlStringBuilder(); xml.halfOpenElement(this); xml.attribute(ATTR_CID, getCandidateId()); @@ -53,12 +53,12 @@ public abstract class JingleS5BTransportInfo extends JingleContentTransportInfo } JingleS5BCandidateTransportInfo otherCandidateTransportInfo = (JingleS5BCandidateTransportInfo) other; - return toXML(null).equals(otherCandidateTransportInfo.toXML(null)); + return toXML().toString().equals(otherCandidateTransportInfo.toXML().toString()); } @Override public final int hashCode() { - return getCandidateId().hashCode(); + return getCandidateId().toString().hashCode(); } } @@ -102,7 +102,7 @@ public abstract class JingleS5BTransportInfo extends JingleContentTransportInfo } @Override - public XmlStringBuilder toXML(String enclosingNamespace) { + public XmlStringBuilder toXML(org.jivesoftware.smack.packet.XmlEnvironment enclosingNamespace) { XmlStringBuilder xml = new XmlStringBuilder(); xml.halfOpenElement(this); xml.closeEmptyElement(); @@ -116,7 +116,7 @@ public abstract class JingleS5BTransportInfo extends JingleContentTransportInfo @Override public int hashCode() { - return toXML(null).toString().hashCode(); + return toXML().toString().hashCode(); } } @@ -134,7 +134,7 @@ public abstract class JingleS5BTransportInfo extends JingleContentTransportInfo } @Override - public CharSequence toXML(String enclosingNamespace) { + public CharSequence toXML(org.jivesoftware.smack.packet.XmlEnvironment enclosingNamespace) { XmlStringBuilder xml = new XmlStringBuilder(); xml.halfOpenElement(this); xml.closeEmptyElement(); @@ -148,7 +148,7 @@ public abstract class JingleS5BTransportInfo extends JingleContentTransportInfo @Override public int hashCode() { - return toXML(null).toString().hashCode(); + return toXML().toString().hashCode(); } } } diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/jiveproperties/packet/JivePropertiesExtension.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/jiveproperties/packet/JivePropertiesExtension.java index 6c80456d6..fb6b11df8 100644 --- a/smack-extensions/src/main/java/org/jivesoftware/smackx/jiveproperties/packet/JivePropertiesExtension.java +++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/jiveproperties/packet/JivePropertiesExtension.java @@ -136,7 +136,7 @@ public class JivePropertiesExtension implements ExtensionElement { } @Override - public CharSequence toXML(String enclosingNamespace) { + public CharSequence toXML(org.jivesoftware.smack.packet.XmlEnvironment enclosingNamespace) { XmlStringBuilder xml = new XmlStringBuilder(this); xml.rightAngleBracket(); // Loop through all properties and write them out. diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/last_interaction/element/IdleElement.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/last_interaction/element/IdleElement.java index 1f98732db..713115abd 100644 --- a/smack-extensions/src/main/java/org/jivesoftware/smackx/last_interaction/element/IdleElement.java +++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/last_interaction/element/IdleElement.java @@ -93,7 +93,7 @@ public class IdleElement implements ExtensionElement { * {@inheritDoc} */ @Override - public XmlStringBuilder toXML(String enclosingNamespace) { + public XmlStringBuilder toXML(org.jivesoftware.smack.packet.XmlEnvironment enclosingNamespace) { return new XmlStringBuilder(this) .attribute(ATTR_SINCE, since) .closeEmptyElement(); diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/message_correct/element/MessageCorrectExtension.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/message_correct/element/MessageCorrectExtension.java index d69dea3ba..03f0c603f 100644 --- a/smack-extensions/src/main/java/org/jivesoftware/smackx/message_correct/element/MessageCorrectExtension.java +++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/message_correct/element/MessageCorrectExtension.java @@ -68,7 +68,7 @@ public class MessageCorrectExtension implements ExtensionElement { } @Override - public XmlStringBuilder toXML(String enclosingNamespace) { + public XmlStringBuilder toXML(org.jivesoftware.smack.packet.XmlEnvironment enclosingNamespace) { XmlStringBuilder xml = new XmlStringBuilder(this); xml.attribute(ID_TAG, getIdInitialMessage()); xml.closeEmptyElement(); diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/mood/element/MoodConcretisation.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/mood/element/MoodConcretisation.java index 228dd63b1..71ef1e43d 100644 --- a/smack-extensions/src/main/java/org/jivesoftware/smackx/mood/element/MoodConcretisation.java +++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/mood/element/MoodConcretisation.java @@ -29,7 +29,7 @@ import org.jivesoftware.smack.util.XmlStringBuilder; public abstract class MoodConcretisation implements ExtensionElement { @Override - public final XmlStringBuilder toXML(String enclosingNamespace) { + public final XmlStringBuilder toXML(org.jivesoftware.smack.packet.XmlEnvironment enclosingNamespace) { return new XmlStringBuilder(this).closeEmptyElement(); } diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/mood/element/MoodElement.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/mood/element/MoodElement.java index 2dcf86356..5db5f4784 100644 --- a/smack-extensions/src/main/java/org/jivesoftware/smackx/mood/element/MoodElement.java +++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/mood/element/MoodElement.java @@ -106,7 +106,7 @@ public class MoodElement implements ExtensionElement { } @Override - public XmlStringBuilder toXML(String enclosingNamespace) { + public XmlStringBuilder toXML(org.jivesoftware.smack.packet.XmlEnvironment enclosingNamespace) { XmlStringBuilder xml = new XmlStringBuilder(this); if (mood == null && text == null) { @@ -167,7 +167,7 @@ public class MoodElement implements ExtensionElement { } @Override - public XmlStringBuilder toXML(String enclosingNamespace) { + public XmlStringBuilder toXML(org.jivesoftware.smack.packet.XmlEnvironment enclosingNamespace) { XmlStringBuilder xml = new XmlStringBuilder(); if (concretisation == null) { @@ -175,7 +175,7 @@ public class MoodElement implements ExtensionElement { } return xml.openElement(getElementName()) - .append(concretisation.toXML(null)) + .append(concretisation.toXML()) .closeElement(getElementName()); } diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/muc/MultiUserChatManager.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/muc/MultiUserChatManager.java index 1730e4a67..0169cd4a4 100644 --- a/smack-extensions/src/main/java/org/jivesoftware/smackx/muc/MultiUserChatManager.java +++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/muc/MultiUserChatManager.java @@ -166,7 +166,7 @@ public final class MultiUserChatManager extends Manager { if (mucUser.getInvite() != null) { EntityBareJid mucJid = message.getFrom().asEntityBareJidIfPossible(); if (mucJid == null) { - LOGGER.warning("Invite to non bare JID: '" + message.toXML(null) + "'"); + LOGGER.warning("Invite to non bare JID: '" + message.toXML() + "'"); return; } // Fire event for invitation listeners diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/muc/RoomInfo.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/muc/RoomInfo.java index 421f957f4..8742d9661 100644 --- a/smack-extensions/src/main/java/org/jivesoftware/smackx/muc/RoomInfo.java +++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/muc/RoomInfo.java @@ -152,7 +152,7 @@ public class RoomInfo { if (!identities.isEmpty()) { this.name = identities.get(0).getName(); } else { - LOGGER.warning("DiscoverInfo does not contain any Identity: " + info.toXML(null)); + LOGGER.warning("DiscoverInfo does not contain any Identity: " + info.toXML()); this.name = ""; } String subject = ""; diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/muc/packet/Destroy.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/muc/packet/Destroy.java index 157a77dd2..1361f79fe 100644 --- a/smack-extensions/src/main/java/org/jivesoftware/smackx/muc/packet/Destroy.java +++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/muc/packet/Destroy.java @@ -69,7 +69,7 @@ public class Destroy implements NamedElement, Serializable { } @Override - public XmlStringBuilder toXML(String enclosingNamespace) { + public XmlStringBuilder toXML(org.jivesoftware.smack.packet.XmlEnvironment enclosingNamespace) { XmlStringBuilder xml = new XmlStringBuilder(this); xml.optAttribute("jid", getJid()); xml.rightAngleBracket(); diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/muc/packet/GroupChatInvitation.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/muc/packet/GroupChatInvitation.java index 6b2721b42..41ad4241e 100644 --- a/smack-extensions/src/main/java/org/jivesoftware/smackx/muc/packet/GroupChatInvitation.java +++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/muc/packet/GroupChatInvitation.java @@ -104,7 +104,7 @@ public class GroupChatInvitation implements ExtensionElement { } @Override - public XmlStringBuilder toXML(String enclosingNamespace) { + public XmlStringBuilder toXML(org.jivesoftware.smack.packet.XmlEnvironment enclosingNamespace) { XmlStringBuilder xml = new XmlStringBuilder(this); xml.attribute("jid", getRoomAddress()); xml.closeEmptyElement(); diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/muc/packet/MUCAdmin.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/muc/packet/MUCAdmin.java index a718b46fb..bc0b13a9b 100644 --- a/smack-extensions/src/main/java/org/jivesoftware/smackx/muc/packet/MUCAdmin.java +++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/muc/packet/MUCAdmin.java @@ -71,7 +71,7 @@ public class MUCAdmin extends IQ { synchronized (items) { for (MUCItem item : items) { - xml.append(item.toXML(null)); + xml.append(item.toXML()); } } diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/muc/packet/MUCInitialPresence.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/muc/packet/MUCInitialPresence.java index 915ebafcf..f96e5e835 100644 --- a/smack-extensions/src/main/java/org/jivesoftware/smackx/muc/packet/MUCInitialPresence.java +++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/muc/packet/MUCInitialPresence.java @@ -84,7 +84,7 @@ public class MUCInitialPresence implements ExtensionElement { } @Override - public XmlStringBuilder toXML(String enclosingNamespace) { + public XmlStringBuilder toXML(org.jivesoftware.smack.packet.XmlEnvironment enclosingNamespace) { XmlStringBuilder xml = new XmlStringBuilder(this); xml.rightAngleBracket(); xml.optElement("password", getPassword()); @@ -286,7 +286,7 @@ public class MUCInitialPresence implements ExtensionElement { } @Override - public XmlStringBuilder toXML(String enclosingNamespace) { + public XmlStringBuilder toXML(org.jivesoftware.smack.packet.XmlEnvironment enclosingNamespace) { XmlStringBuilder xml = new XmlStringBuilder(this); xml.optIntAttribute("maxchars", getMaxChars()); xml.optIntAttribute("maxstanzas", getMaxStanzas()); diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/muc/packet/MUCItem.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/muc/packet/MUCItem.java index c02fb7576..b2b49c9b7 100644 --- a/smack-extensions/src/main/java/org/jivesoftware/smackx/muc/packet/MUCItem.java +++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/muc/packet/MUCItem.java @@ -161,7 +161,7 @@ public class MUCItem implements NamedElement { } @Override - public XmlStringBuilder toXML(String enclosingNamespace) { + public XmlStringBuilder toXML(org.jivesoftware.smack.packet.XmlEnvironment enclosingNamespace) { XmlStringBuilder xml = new XmlStringBuilder(this); xml.optAttribute("affiliation", getAffiliation()); xml.optAttribute("jid", getJid()); diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/muc/packet/MUCOwner.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/muc/packet/MUCOwner.java index 92d70e0dc..82f2bf09b 100644 --- a/smack-extensions/src/main/java/org/jivesoftware/smackx/muc/packet/MUCOwner.java +++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/muc/packet/MUCOwner.java @@ -93,7 +93,7 @@ public class MUCOwner extends IQ { synchronized (items) { for (MUCItem item : items) { - xml.append(item.toXML(null)); + xml.append(item.toXML()); } } xml.optElement(getDestroy()); diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/muc/packet/MUCUser.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/muc/packet/MUCUser.java index b2300f9df..eba5144fe 100644 --- a/smack-extensions/src/main/java/org/jivesoftware/smackx/muc/packet/MUCUser.java +++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/muc/packet/MUCUser.java @@ -61,7 +61,7 @@ public class MUCUser implements ExtensionElement { } @Override - public XmlStringBuilder toXML(String enclosingNamespace) { + public XmlStringBuilder toXML(org.jivesoftware.smack.packet.XmlEnvironment enclosingNamespace) { XmlStringBuilder xml = new XmlStringBuilder(this); xml.rightAngleBracket(); xml.optElement(getInvite()); @@ -301,7 +301,7 @@ public class MUCUser implements ExtensionElement { } @Override - public XmlStringBuilder toXML(String enclosingNamespace) { + public XmlStringBuilder toXML(org.jivesoftware.smack.packet.XmlEnvironment enclosingNamespace) { XmlStringBuilder xml = new XmlStringBuilder(this); xml.optAttribute("to", getTo()); xml.optAttribute("from", getFrom()); @@ -369,7 +369,7 @@ public class MUCUser implements ExtensionElement { } @Override - public XmlStringBuilder toXML(String enclosingNamespace) { + public XmlStringBuilder toXML(org.jivesoftware.smack.packet.XmlEnvironment enclosingNamespace) { XmlStringBuilder xml = new XmlStringBuilder(this); xml.optAttribute("to", getTo()); xml.optAttribute("from", getFrom()); @@ -439,7 +439,7 @@ public class MUCUser implements ExtensionElement { } @Override - public XmlStringBuilder toXML(String enclosingNamespace) { + public XmlStringBuilder toXML(org.jivesoftware.smack.packet.XmlEnvironment enclosingNamespace) { XmlStringBuilder xml = new XmlStringBuilder(this); xml.attribute("code", getCode()); xml.closeEmptyElement(); diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/nick/packet/Nick.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/nick/packet/Nick.java index 78f7507d7..ef95d395d 100644 --- a/smack-extensions/src/main/java/org/jivesoftware/smackx/nick/packet/Nick.java +++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/nick/packet/Nick.java @@ -58,7 +58,7 @@ public class Nick implements ExtensionElement { } @Override - public XmlStringBuilder toXML(String enclosingNamespace) { + public XmlStringBuilder toXML(org.jivesoftware.smack.packet.XmlEnvironment enclosingNamespace) { XmlStringBuilder xml = new XmlStringBuilder(this, enclosingNamespace); xml.rightAngleBracket(); diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/offline/packet/OfflineMessageInfo.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/offline/packet/OfflineMessageInfo.java index 6ce937cb5..8b222d128 100644 --- a/smack-extensions/src/main/java/org/jivesoftware/smackx/offline/packet/OfflineMessageInfo.java +++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/offline/packet/OfflineMessageInfo.java @@ -82,7 +82,7 @@ public class OfflineMessageInfo implements ExtensionElement { } @Override - public String toXML(String enclosingNamespace) { + public String toXML(org.jivesoftware.smack.packet.XmlEnvironment enclosingNamespace) { StringBuilder buf = new StringBuilder(); buf.append('<').append(getElementName()).append(" xmlns=\"").append(getNamespace()).append( "\">"); diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/Affiliation.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/Affiliation.java index 5f4769639..0a7e10d09 100644 --- a/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/Affiliation.java +++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/Affiliation.java @@ -174,7 +174,7 @@ public class Affiliation implements ExtensionElement { } @Override - public XmlStringBuilder toXML(String enclosingNamespace) { + public XmlStringBuilder toXML(org.jivesoftware.smack.packet.XmlEnvironment enclosingNamespace) { XmlStringBuilder xml = new XmlStringBuilder(this); xml.optAttribute("node", node); xml.optAttribute("jid", jid); diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/AffiliationsExtension.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/AffiliationsExtension.java index fcda5b2f2..2e30dd04c 100644 --- a/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/AffiliationsExtension.java +++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/AffiliationsExtension.java @@ -61,7 +61,7 @@ public class AffiliationsExtension extends NodeExtension { } @Override - public CharSequence toXML(String enclosingNamespace) { + public CharSequence toXML(org.jivesoftware.smack.packet.XmlEnvironment enclosingNamespace) { if ((items == null) || (items.size() == 0)) { return super.toXML(enclosingNamespace); } diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/EventElement.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/EventElement.java index 48449db56..70e0750ba 100644 --- a/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/EventElement.java +++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/EventElement.java @@ -76,10 +76,10 @@ public class EventElement implements EmbeddedPacketExtension { } @Override - public XmlStringBuilder toXML(String enclosingNamespace) { + public XmlStringBuilder toXML(org.jivesoftware.smack.packet.XmlEnvironment enclosingNamespace) { XmlStringBuilder xml = new XmlStringBuilder(this); xml.rightAngleBracket(); - xml.append(ext.toXML(null)); + xml.append(ext.toXML()); xml.closeElement(this); return xml; } diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/FormNode.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/FormNode.java index 91db0fa56..9562dd4a0 100644 --- a/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/FormNode.java +++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/FormNode.java @@ -69,7 +69,7 @@ public class FormNode extends NodeExtension { } @Override - public CharSequence toXML(String enclosingNamespace) { + public CharSequence toXML(org.jivesoftware.smack.packet.XmlEnvironment enclosingNamespace) { if (configForm == null) { return super.toXML(enclosingNamespace); } @@ -84,7 +84,7 @@ public class FormNode extends NodeExtension { } else builder.append('>'); - builder.append(configForm.getDataFormToSend().toXML(null)); + builder.append(configForm.getDataFormToSend().toXML()); builder.append("'); return builder.toString(); diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/GetItemsRequest.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/GetItemsRequest.java index a6b274f93..d55637a7c 100644 --- a/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/GetItemsRequest.java +++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/GetItemsRequest.java @@ -54,7 +54,7 @@ public class GetItemsRequest extends NodeExtension { } @Override - public XmlStringBuilder toXML(String enclosingNamespace) { + public XmlStringBuilder toXML(org.jivesoftware.smack.packet.XmlEnvironment enclosingNamespace) { XmlStringBuilder xml = new XmlStringBuilder(); xml.halfOpenElement(getElementName()); xml.attribute("node", getNode()); diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/Item.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/Item.java index c9e12df7a..ec1f5ca02 100644 --- a/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/Item.java +++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/Item.java @@ -147,7 +147,7 @@ public class Item extends NodeExtension { } @Override - public XmlStringBuilder toXML(String enclosingNamespace) { + public XmlStringBuilder toXML(org.jivesoftware.smack.packet.XmlEnvironment enclosingNamespace) { XmlStringBuilder xml = getCommonXml(); xml.closeEmptyElement(); @@ -166,7 +166,7 @@ public class Item extends NodeExtension { @Override public String toString() { - return getClass().getName() + " | Content [" + toXML(null) + "]"; + return getClass().getName() + " | Content [" + toXML() + "]"; } } diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/ItemsExtension.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/ItemsExtension.java index b545cbb14..c960a8843 100644 --- a/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/ItemsExtension.java +++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/ItemsExtension.java @@ -149,7 +149,7 @@ public class ItemsExtension extends NodeExtension implements EmbeddedPacketExten } @Override - public CharSequence toXML(String enclosingNamespace) { + public CharSequence toXML(org.jivesoftware.smack.packet.XmlEnvironment enclosingNamespace) { if ((items == null) || (items.size() == 0)) { return super.toXML(enclosingNamespace); } @@ -169,7 +169,7 @@ public class ItemsExtension extends NodeExtension implements EmbeddedPacketExten else { builder.append("'>"); for (NamedElement item : items) { - builder.append(item.toXML(null)); + builder.append(item.toXML()); } } @@ -182,7 +182,7 @@ public class ItemsExtension extends NodeExtension implements EmbeddedPacketExten @Override public String toString() { - return getClass().getName() + "Content [" + toXML(null) + "]"; + return getClass().getName() + "Content [" + toXML() + "]"; } } diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/NodeExtension.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/NodeExtension.java index 23783e317..5cda91fa4 100644 --- a/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/NodeExtension.java +++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/NodeExtension.java @@ -78,12 +78,12 @@ public class NodeExtension implements ExtensionElement { } @Override - public CharSequence toXML(String enclosingNamespace) { + public CharSequence toXML(org.jivesoftware.smack.packet.XmlEnvironment enclosingNamespace) { return '<' + getElementName() + (node == null ? "" : " node='" + node + '\'') + "/>"; } @Override public String toString() { - return getClass().getName() + " - content [" + toXML(null) + "]"; + return getClass().getName() + " - content [" + toXML() + "]"; } } diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/OptionsExtension.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/OptionsExtension.java index 4ff697d6f..c9bbf6ab2 100644 --- a/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/OptionsExtension.java +++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/OptionsExtension.java @@ -50,7 +50,7 @@ public class OptionsExtension extends NodeExtension { } @Override - public XmlStringBuilder toXML(String enclosingNamespace) { + public XmlStringBuilder toXML(org.jivesoftware.smack.packet.XmlEnvironment enclosingNamespace) { XmlStringBuilder xml = new XmlStringBuilder(); xml.halfOpenElement(getElementName()); xml.attribute("jid", jid); diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/PayloadItem.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/PayloadItem.java index 841a55868..59fe54acc 100644 --- a/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/PayloadItem.java +++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/PayloadItem.java @@ -130,11 +130,11 @@ public class PayloadItem extends Item { } @Override - public XmlStringBuilder toXML(String enclosingNamespace) { + public XmlStringBuilder toXML(org.jivesoftware.smack.packet.XmlEnvironment enclosingNamespace) { XmlStringBuilder xml = getCommonXml(); xml.rightAngleBracket(); - xml.append(payload.toXML(null)); + xml.append(payload.toXML()); xml.closeElement(this); return xml; @@ -142,6 +142,6 @@ public class PayloadItem extends Item { @Override public String toString() { - return getClass().getName() + " | Content [" + toXML(null) + "]"; + return getClass().getName() + " | Content [" + toXML() + "]"; } } diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/PublishItem.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/PublishItem.java index b282f28af..ec38e7aa5 100644 --- a/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/PublishItem.java +++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/PublishItem.java @@ -51,7 +51,7 @@ public class PublishItem extends NodeExtension { } @Override - public String toXML(String enclosingNamespace) { + public String toXML(org.jivesoftware.smack.packet.XmlEnvironment enclosingNamespace) { StringBuilder builder = new StringBuilder("<"); builder.append(getElementName()); builder.append(" node='"); @@ -59,7 +59,7 @@ public class PublishItem extends NodeExtension { builder.append("'>"); for (Item item : items) { - builder.append(item.toXML(null)); + builder.append(item.toXML()); } builder.append(""); diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/RetractItem.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/RetractItem.java index ff37bebc8..3bb4acfd4 100644 --- a/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/RetractItem.java +++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/RetractItem.java @@ -54,7 +54,7 @@ public class RetractItem implements ExtensionElement { } @Override - public String toXML(String enclosingNamespace) { + public String toXML(org.jivesoftware.smack.packet.XmlEnvironment enclosingNamespace) { return ""; } } diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/SimplePayload.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/SimplePayload.java index 781e9cda7..529ff1fa1 100644 --- a/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/SimplePayload.java +++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/SimplePayload.java @@ -93,12 +93,12 @@ public class SimplePayload implements ExtensionElement { } @Override - public String toXML(String enclosingNamespace) { + public String toXML(org.jivesoftware.smack.packet.XmlEnvironment enclosingNamespace) { return payload; } @Override public String toString() { - return getClass().getName() + "payload [" + toXML(null) + "]"; + return getClass().getName() + "payload [" + toXML() + "]"; } } diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/SubscribeExtension.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/SubscribeExtension.java index 1ce28aadb..92e6c0b37 100644 --- a/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/SubscribeExtension.java +++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/SubscribeExtension.java @@ -39,7 +39,7 @@ public class SubscribeExtension extends NodeExtension { } @Override - public String toXML(String enclosingNamespace) { + public String toXML(org.jivesoftware.smack.packet.XmlEnvironment enclosingNamespace) { StringBuilder builder = new StringBuilder("<"); builder.append(getElementName()); diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/Subscription.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/Subscription.java index db2114ca7..3b81ca016 100644 --- a/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/Subscription.java +++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/Subscription.java @@ -138,7 +138,7 @@ public class Subscription extends NodeExtension { } @Override - public XmlStringBuilder toXML(String enclosingNamespace) { + public XmlStringBuilder toXML(org.jivesoftware.smack.packet.XmlEnvironment enclosingNamespace) { XmlStringBuilder builder = new XmlStringBuilder(this); builder.attribute("jid", jid); diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/SubscriptionsExtension.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/SubscriptionsExtension.java index 0071c5562..8abde5836 100644 --- a/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/SubscriptionsExtension.java +++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/SubscriptionsExtension.java @@ -91,7 +91,7 @@ public class SubscriptionsExtension extends NodeExtension { } @Override - public CharSequence toXML(String enclosingNamespace) { + public CharSequence toXML(org.jivesoftware.smack.packet.XmlEnvironment enclosingNamespace) { if ((items == null) || (items.size() == 0)) { return super.toXML(enclosingNamespace); } @@ -107,7 +107,7 @@ public class SubscriptionsExtension extends NodeExtension { builder.append('>'); for (Subscription item : items) { - builder.append(item.toXML(null)); + builder.append(item.toXML()); } builder.append(""; } diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/rsm/packet/RSMSet.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/rsm/packet/RSMSet.java index a8e7772b7..40301863d 100644 --- a/smack-extensions/src/main/java/org/jivesoftware/smackx/rsm/packet/RSMSet.java +++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/rsm/packet/RSMSet.java @@ -127,7 +127,7 @@ public class RSMSet implements ExtensionElement { } @Override - public XmlStringBuilder toXML(String enclosingNamespace) { + public XmlStringBuilder toXML(org.jivesoftware.smack.packet.XmlEnvironment enclosingNamespace) { XmlStringBuilder xml = new XmlStringBuilder(this); xml.rightAngleBracket(); xml.optElement("after", after); diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/shim/packet/Header.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/shim/packet/Header.java index b3e1e68ab..dd53595db 100644 --- a/smack-extensions/src/main/java/org/jivesoftware/smackx/shim/packet/Header.java +++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/shim/packet/Header.java @@ -55,7 +55,7 @@ public class Header implements ExtensionElement { } @Override - public XmlStringBuilder toXML(String enclosingNamespace) { + public XmlStringBuilder toXML(org.jivesoftware.smack.packet.XmlEnvironment enclosingNamespace) { // Upcast to NamedElement since we don't want a xmlns attribute XmlStringBuilder xml = new XmlStringBuilder((NamedElement) this); xml.attribute("name", name); diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/shim/packet/HeadersExtension.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/shim/packet/HeadersExtension.java index aeedc741f..d56051289 100644 --- a/smack-extensions/src/main/java/org/jivesoftware/smackx/shim/packet/HeadersExtension.java +++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/shim/packet/HeadersExtension.java @@ -59,7 +59,7 @@ public class HeadersExtension implements ExtensionElement { } @Override - public XmlStringBuilder toXML(String enclosingNamespace) { + public XmlStringBuilder toXML(org.jivesoftware.smack.packet.XmlEnvironment enclosingNamespace) { XmlStringBuilder xml = new XmlStringBuilder(this); xml.rightAngleBracket(); xml.append(headers); diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/si/packet/StreamInitiation.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/si/packet/StreamInitiation.java index b6c15d7f2..87c879cff 100644 --- a/smack-extensions/src/main/java/org/jivesoftware/smackx/si/packet/StreamInitiation.java +++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/si/packet/StreamInitiation.java @@ -146,7 +146,7 @@ public class StreamInitiation extends IQ { buf.rightAngleBracket(); // Add the file section if there is one. - buf.optAppend(file.toXML(null)); + buf.optAppend(file.toXML()); break; case result: buf.rightAngleBracket(); @@ -155,7 +155,7 @@ public class StreamInitiation extends IQ { throw new IllegalArgumentException("IQ Type not understood"); } if (featureNegotiation != null) { - buf.append(featureNegotiation.toXML(null)); + buf.append(featureNegotiation.toXML()); } return buf; } @@ -327,7 +327,7 @@ public class StreamInitiation extends IQ { } @Override - public String toXML(String enclosingNamespace) { + public String toXML(org.jivesoftware.smack.packet.XmlEnvironment enclosingNamespace) { StringBuilder buffer = new StringBuilder(); buffer.append('<').append(getElementName()).append(" xmlns=\"") @@ -405,11 +405,11 @@ public class StreamInitiation extends IQ { } @Override - public String toXML(String enclosingNamespace) { + public String toXML(org.jivesoftware.smack.packet.XmlEnvironment enclosingNamespace) { StringBuilder buf = new StringBuilder(); buf .append(""); - buf.append(data.toXML(null)); + buf.append(data.toXML()); buf.append(""); return buf.toString(); } diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/xdata/FormField.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/xdata/FormField.java index b14be2ca5..d092d7092 100644 --- a/smack-extensions/src/main/java/org/jivesoftware/smackx/xdata/FormField.java +++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/xdata/FormField.java @@ -24,6 +24,7 @@ import java.util.Date; import java.util.List; import org.jivesoftware.smack.packet.NamedElement; +import org.jivesoftware.smack.packet.XmlEnvironment; import org.jivesoftware.smack.util.StringUtils; import org.jivesoftware.smack.util.XmlStringBuilder; @@ -433,7 +434,7 @@ public class FormField implements NamedElement { } @Override - public XmlStringBuilder toXML(String enclosingNamespace) { + public XmlStringBuilder toXML(XmlEnvironment enclosingNamespace) { XmlStringBuilder buf = new XmlStringBuilder(this); // Add attributes buf.optAttribute("label", getLabel()); @@ -449,7 +450,7 @@ public class FormField implements NamedElement { } // Loop through all the values and append them to the string buffer for (Option option : getOptions()) { - buf.append(option.toXML(null)); + buf.append(option.toXML()); } buf.optElement(validateElement); buf.closeElement(this); @@ -467,12 +468,12 @@ public class FormField implements NamedElement { FormField other = (FormField) obj; - return toXML(null).equals(other.toXML(null)); + return toXML().toString().equals(other.toXML().toString()); } @Override public int hashCode() { - return toXML(null).hashCode(); + return toXML().toString().hashCode(); } /** @@ -525,7 +526,7 @@ public class FormField implements NamedElement { } @Override - public XmlStringBuilder toXML(String enclosingNamespace) { + public XmlStringBuilder toXML(org.jivesoftware.smack.packet.XmlEnvironment enclosingNamespace) { XmlStringBuilder xml = new XmlStringBuilder(this); // Add attribute xml.optAttribute("label", getLabel()); diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/xdata/packet/DataForm.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/xdata/packet/DataForm.java index 326a3a248..f9744e06a 100644 --- a/smack-extensions/src/main/java/org/jivesoftware/smackx/xdata/packet/DataForm.java +++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/xdata/packet/DataForm.java @@ -312,7 +312,7 @@ public class DataForm implements ExtensionElement { } @Override - public XmlStringBuilder toXML(String enclosingNamespace) { + public XmlStringBuilder toXML(org.jivesoftware.smack.packet.XmlEnvironment enclosingNamespace) { XmlStringBuilder buf = new XmlStringBuilder(this); buf.attribute("type", getType()); buf.rightAngleBracket(); @@ -331,10 +331,10 @@ public class DataForm implements ExtensionElement { } // Loop through all the form fields and append them to the string buffer for (FormField field : getFields()) { - buf.append(field.toXML(null)); + buf.append(field.toXML()); } for (Element element : extensionElements) { - buf.append(element.toXML(null)); + buf.append(element.toXML()); } buf.closeElement(this); return buf; @@ -379,7 +379,7 @@ public class DataForm implements ExtensionElement { buf.openElement(ELEMENT); // Loop through all the form items and append them to the string buffer for (FormField field : getFields()) { - buf.append(field.toXML(null)); + buf.append(field.toXML()); } buf.closeElement(ELEMENT); return buf; @@ -415,7 +415,7 @@ public class DataForm implements ExtensionElement { buf.openElement(ELEMENT); // Loop through all the form items and append them to the string buffer for (FormField field : getFields()) { - buf.append(field.toXML(null)); + buf.append(field.toXML()); } buf.closeElement(ELEMENT); return buf; diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/xdatalayout/packet/DataLayout.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/xdatalayout/packet/DataLayout.java index 21edbce98..59f0e2f72 100644 --- a/smack-extensions/src/main/java/org/jivesoftware/smackx/xdatalayout/packet/DataLayout.java +++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/xdatalayout/packet/DataLayout.java @@ -91,7 +91,7 @@ public class DataLayout implements ExtensionElement { * @see org.jivesoftware.smack.packet.PacketExtension#toXML() */ @Override - public XmlStringBuilder toXML(String enclosingNamespace) { + public XmlStringBuilder toXML(org.jivesoftware.smack.packet.XmlEnvironment enclosingNamespace) { XmlStringBuilder buf = new XmlStringBuilder(this); buf.optAttribute("label", getLabel()); buf.rightAngleBracket(); @@ -109,7 +109,7 @@ public class DataLayout implements ExtensionElement { */ private static void walkList(XmlStringBuilder buf, List pageLayout) { for (DataFormLayoutElement object : pageLayout) { - buf.append(object.toXML(null)); + buf.append(object.toXML()); } } @@ -127,7 +127,7 @@ public class DataLayout implements ExtensionElement { } @Override - public XmlStringBuilder toXML(String enclosingNamespace) { + public XmlStringBuilder toXML(org.jivesoftware.smack.packet.XmlEnvironment enclosingNamespace) { XmlStringBuilder buf = new XmlStringBuilder(this); buf.attribute("var", getVar()); buf.closeEmptyElement(); @@ -187,7 +187,7 @@ public class DataLayout implements ExtensionElement { } @Override - public XmlStringBuilder toXML(String enclosingNamespace) { + public XmlStringBuilder toXML(org.jivesoftware.smack.packet.XmlEnvironment enclosingNamespace) { XmlStringBuilder buf = new XmlStringBuilder(this); buf.optAttribute("label", getLabel()); buf.rightAngleBracket(); @@ -218,7 +218,7 @@ public class DataLayout implements ExtensionElement { public static final String ELEMENT = "reportedref"; @Override - public XmlStringBuilder toXML(String enclosingNamespace) { + public XmlStringBuilder toXML(org.jivesoftware.smack.packet.XmlEnvironment enclosingNamespace) { XmlStringBuilder buf = new XmlStringBuilder(this); buf.closeEmptyElement(); return buf; @@ -244,7 +244,7 @@ public class DataLayout implements ExtensionElement { } @Override - public XmlStringBuilder toXML(String enclosingNamespace) { + public XmlStringBuilder toXML(org.jivesoftware.smack.packet.XmlEnvironment enclosingNamespace) { XmlStringBuilder buf = new XmlStringBuilder(); buf.element(ELEMENT, getText()); return buf; diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/xdatavalidation/packet/ValidateElement.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/xdatavalidation/packet/ValidateElement.java index 188e163ad..4dc7fd62b 100644 --- a/smack-extensions/src/main/java/org/jivesoftware/smackx/xdatavalidation/packet/ValidateElement.java +++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/xdatavalidation/packet/ValidateElement.java @@ -83,7 +83,7 @@ public abstract class ValidateElement implements ExtensionElement { } @Override - public XmlStringBuilder toXML(String enclosingNamespace) { + public XmlStringBuilder toXML(org.jivesoftware.smack.packet.XmlEnvironment enclosingNamespace) { XmlStringBuilder buf = new XmlStringBuilder(this); buf.optAttribute("datatype", datatype); buf.rightAngleBracket(); @@ -346,7 +346,7 @@ public abstract class ValidateElement implements ExtensionElement { } @Override - public XmlStringBuilder toXML(String enclosingNamespace) { + public XmlStringBuilder toXML(org.jivesoftware.smack.packet.XmlEnvironment enclosingNamespace) { XmlStringBuilder buf = new XmlStringBuilder(this); buf.optLongAttribute("min", getMin()); buf.optLongAttribute("max", getMax()); diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/xhtmlim/packet/XHTMLExtension.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/xhtmlim/packet/XHTMLExtension.java index 3653f56b1..a87124fa5 100644 --- a/smack-extensions/src/main/java/org/jivesoftware/smackx/xhtmlim/packet/XHTMLExtension.java +++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/xhtmlim/packet/XHTMLExtension.java @@ -81,7 +81,7 @@ public class XHTMLExtension implements ExtensionElement { * */ @Override - public XmlStringBuilder toXML(String enclosingNamespace) { + public XmlStringBuilder toXML(org.jivesoftware.smack.packet.XmlEnvironment enclosingNamespace) { XmlStringBuilder xml = new XmlStringBuilder(this); xml.rightAngleBracket(); // Loop through all the bodies and append them to the string buffer diff --git a/smack-extensions/src/test/java/org/jivesoftware/smackx/amp/AMPExtensionTest.java b/smack-extensions/src/test/java/org/jivesoftware/smackx/amp/AMPExtensionTest.java index 4341c8265..f586b3b81 100644 --- a/smack-extensions/src/test/java/org/jivesoftware/smackx/amp/AMPExtensionTest.java +++ b/smack-extensions/src/test/java/org/jivesoftware/smackx/amp/AMPExtensionTest.java @@ -59,7 +59,7 @@ public class AMPExtensionTest { ext.addRule(new AMPExtension.Rule(AMPExtension.Action.notify, new AMPMatchResourceCondition(AMPMatchResourceCondition.Value.exact))); ext.addRule(new AMPExtension.Rule(AMPExtension.Action.notify, new AMPMatchResourceCondition(AMPMatchResourceCondition.Value.other))); - assertEquals(correctStanza, ext.toXML(null)); + assertEquals(correctStanza, ext.toXML().toString()); } @Test diff --git a/smack-extensions/src/test/java/org/jivesoftware/smackx/blocking/BlockContactsIQTest.java b/smack-extensions/src/test/java/org/jivesoftware/smackx/blocking/BlockContactsIQTest.java index 8a92e81cd..f6bcafc7a 100644 --- a/smack-extensions/src/test/java/org/jivesoftware/smackx/blocking/BlockContactsIQTest.java +++ b/smack-extensions/src/test/java/org/jivesoftware/smackx/blocking/BlockContactsIQTest.java @@ -47,7 +47,7 @@ public class BlockContactsIQTest { BlockContactsIQ blockContactIQ = new BlockContactsIQ(jids); blockContactIQ.setStanzaId("block1"); - Assert.assertEquals(blockContactIQExample, blockContactIQ.toXML(null).toString()); + Assert.assertEquals(blockContactIQExample, blockContactIQ.toXML().toString()); } @Test diff --git a/smack-extensions/src/test/java/org/jivesoftware/smackx/bytestreams/ibb/packet/DataPacketExtensionTest.java b/smack-extensions/src/test/java/org/jivesoftware/smackx/bytestreams/ibb/packet/DataPacketExtensionTest.java index f3c881aa6..f29e15e49 100644 --- a/smack-extensions/src/test/java/org/jivesoftware/smackx/bytestreams/ibb/packet/DataPacketExtensionTest.java +++ b/smack-extensions/src/test/java/org/jivesoftware/smackx/bytestreams/ibb/packet/DataPacketExtensionTest.java @@ -96,7 +96,7 @@ public class DataPacketExtensionTest extends InitExtensions { .asString(outputProperties); DataPacketExtension data = new DataPacketExtension("i781hf64", 0, "DATA"); - assertXMLEqual(control, data.toXML(null).toString()); + assertXMLEqual(control, data.toXML().toString()); } } diff --git a/smack-extensions/src/test/java/org/jivesoftware/smackx/caps/EntityCapsManagerTest.java b/smack-extensions/src/test/java/org/jivesoftware/smackx/caps/EntityCapsManagerTest.java index 2810e8494..54d9e04dc 100644 --- a/smack-extensions/src/test/java/org/jivesoftware/smackx/caps/EntityCapsManagerTest.java +++ b/smack-extensions/src/test/java/org/jivesoftware/smackx/caps/EntityCapsManagerTest.java @@ -92,7 +92,7 @@ public class EntityCapsManagerTest extends InitExtensions { DiscoverInfo restored_di = EntityCapsManager.getDiscoveryInfoByNodeVer(nodeVer); assertNotNull(restored_di); - assertEquals(di.toXML(null).toString(), restored_di.toXML(null).toString()); + assertEquals(di.toXML().toString(), restored_di.toXML().toString()); } private static DiscoverInfo createComplexSamplePacket() throws XmppStringprepException { diff --git a/smack-extensions/src/test/java/org/jivesoftware/smackx/filetransfer/FileTransferNegotiatorTest.java b/smack-extensions/src/test/java/org/jivesoftware/smackx/filetransfer/FileTransferNegotiatorTest.java index ec401fd67..cd0bf2e0e 100644 --- a/smack-extensions/src/test/java/org/jivesoftware/smackx/filetransfer/FileTransferNegotiatorTest.java +++ b/smack-extensions/src/test/java/org/jivesoftware/smackx/filetransfer/FileTransferNegotiatorTest.java @@ -56,7 +56,7 @@ public class FileTransferNegotiatorTest extends InitExtensions { // We do not expect an answer. This unit test only checks the request sent. } Stanza packet = connection.getSentPacket(); - String xml = packet.toXML(null).toString(); + String xml = packet.toXML().toString(); assertTrue(xml.indexOf("var='stream-method' type='list-single'") != -1); } } diff --git a/smack-extensions/src/test/java/org/jivesoftware/smackx/geoloc/packet/GeoLocationTest.java b/smack-extensions/src/test/java/org/jivesoftware/smackx/geoloc/packet/GeoLocationTest.java index a80748377..d6114ebdc 100644 --- a/smack-extensions/src/test/java/org/jivesoftware/smackx/geoloc/packet/GeoLocationTest.java +++ b/smack-extensions/src/test/java/org/jivesoftware/smackx/geoloc/packet/GeoLocationTest.java @@ -120,7 +120,7 @@ public class GeoLocationTest extends InitExtensions { GeoLocation geoLocation = messageWithGeoLocation.getExtension(GeoLocation.ELEMENT, GeoLocation.NAMESPACE); assertNotNull(geoLocation); - assertNotNull(geoLocation.toXML(null)); + assertNotNull(geoLocation.toXML()); GeoLocation constructedGeoLocation = GeoLocation.builder().setAccuracy(23d).setAlt(1000d).setAltAccuracy(10d).setArea("Delhi").setBearing( 10d).setBuilding("Small Building").setCountry("India").setCountryCode("IN").setDescription( @@ -129,7 +129,7 @@ public class GeoLocationTest extends InitExtensions { "Wall Street").setText("Unit Testing GeoLocation").setTimestamp( XmppDateTime.parseDate("2004-02-19")).setTzo("+5:30").setUri(new URI("http://xmpp.org")).build(); - assertEquals(constructedGeoLocation.toXML(null).toString(), geoLocation.toXML(null).toString()); + assertEquals(constructedGeoLocation.toXML().toString(), geoLocation.toXML().toString()); } diff --git a/smack-extensions/src/test/java/org/jivesoftware/smackx/jingle/JingleContentTest.java b/smack-extensions/src/test/java/org/jivesoftware/smackx/jingle/JingleContentTest.java index ac7b5c85b..bd1a430a8 100644 --- a/smack-extensions/src/test/java/org/jivesoftware/smackx/jingle/JingleContentTest.java +++ b/smack-extensions/src/test/java/org/jivesoftware/smackx/jingle/JingleContentTest.java @@ -65,12 +65,12 @@ public class JingleContentTest extends SmackTestSuite { builder.setDisposition("session"); JingleContent content1 = builder.build(); assertEquals("session", content1.getDisposition()); - assertNotSame(content.toXML(null).toString(), content1.toXML(null).toString()); - assertEquals(content1.toXML(null).toString(), builder.build().toXML(null).toString()); + assertNotSame(content.toXML().toString(), content1.toXML().toString()); + assertEquals(content1.toXML().toString(), builder.build().toXML().toString()); String xml = "" + ""; - assertEquals(xml, content1.toXML(null).toString()); + assertEquals(xml, content1.toXML().toString()); } } diff --git a/smack-extensions/src/test/java/org/jivesoftware/smackx/jingle/JingleErrorTest.java b/smack-extensions/src/test/java/org/jivesoftware/smackx/jingle/JingleErrorTest.java index 1f140bf9f..6ca6d88a9 100644 --- a/smack-extensions/src/test/java/org/jivesoftware/smackx/jingle/JingleErrorTest.java +++ b/smack-extensions/src/test/java/org/jivesoftware/smackx/jingle/JingleErrorTest.java @@ -34,28 +34,28 @@ public class JingleErrorTest extends SmackTestSuite { public void tieBreakTest() throws Exception { String xml = ""; JingleError error = new JingleErrorProvider().parse(TestUtils.getParser(xml)); - assertEquals(xml, error.toXML(null).toString()); + assertEquals(xml, error.toXML().toString()); } @Test public void unknownSessionTest() throws Exception { String xml = ""; JingleError error = new JingleErrorProvider().parse(TestUtils.getParser(xml)); - assertEquals(xml, error.toXML(null).toString()); + assertEquals(xml, error.toXML().toString()); } @Test public void unsupportedInfoTest() throws Exception { String xml = ""; JingleError error = new JingleErrorProvider().parse(TestUtils.getParser(xml)); - assertEquals(xml, error.toXML(null).toString()); + assertEquals(xml, error.toXML().toString()); } @Test public void outOfOrderTest() throws Exception { String xml = ""; JingleError error = new JingleErrorProvider().parse(TestUtils.getParser(xml)); - assertEquals(xml, error.toXML(null).toString()); + assertEquals(xml, error.toXML().toString()); } @Test(expected = IllegalArgumentException.class) diff --git a/smack-extensions/src/test/java/org/jivesoftware/smackx/jingle/JingleReasonTest.java b/smack-extensions/src/test/java/org/jivesoftware/smackx/jingle/JingleReasonTest.java index fc87f4668..d62de70b3 100644 --- a/smack-extensions/src/test/java/org/jivesoftware/smackx/jingle/JingleReasonTest.java +++ b/smack-extensions/src/test/java/org/jivesoftware/smackx/jingle/JingleReasonTest.java @@ -32,39 +32,39 @@ public class JingleReasonTest extends SmackTestSuite { @Test public void parserTest() { assertEquals("", - JingleReason.Success.toXML(null).toString()); + JingleReason.Success.toXML().toString()); assertEquals("", - JingleReason.Busy.toXML(null).toString()); + JingleReason.Busy.toXML().toString()); assertEquals("", - JingleReason.Cancel.toXML(null).toString()); + JingleReason.Cancel.toXML().toString()); assertEquals("", - JingleReason.ConnectivityError.toXML(null).toString()); + JingleReason.ConnectivityError.toXML().toString()); assertEquals("", - JingleReason.Decline.toXML(null).toString()); + JingleReason.Decline.toXML().toString()); assertEquals("", - JingleReason.Expired.toXML(null).toString()); + JingleReason.Expired.toXML().toString()); assertEquals("", - JingleReason.UnsupportedTransports.toXML(null).toString()); + JingleReason.UnsupportedTransports.toXML().toString()); assertEquals("", - JingleReason.FailedTransport.toXML(null).toString()); + JingleReason.FailedTransport.toXML().toString()); assertEquals("", - JingleReason.GeneralError.toXML(null).toString()); + JingleReason.GeneralError.toXML().toString()); assertEquals("", - JingleReason.Gone.toXML(null).toString()); + JingleReason.Gone.toXML().toString()); assertEquals("", - JingleReason.MediaError.toXML(null).toString()); + JingleReason.MediaError.toXML().toString()); assertEquals("", - JingleReason.SecurityError.toXML(null).toString()); + JingleReason.SecurityError.toXML().toString()); assertEquals("", - JingleReason.UnsupportedApplications.toXML(null).toString()); + JingleReason.UnsupportedApplications.toXML().toString()); assertEquals("", - JingleReason.Timeout.toXML(null).toString()); + JingleReason.Timeout.toXML().toString()); assertEquals("", - JingleReason.FailedApplication.toXML(null).toString()); + JingleReason.FailedApplication.toXML().toString()); assertEquals("", - JingleReason.IncompatibleParameters.toXML(null).toString()); + JingleReason.IncompatibleParameters.toXML().toString()); assertEquals("1234", - JingleReason.AlternativeSession("1234").toXML(null).toString()); + JingleReason.AlternativeSession("1234").toXML().toString()); } @Test(expected = NullPointerException.class) diff --git a/smack-extensions/src/test/java/org/jivesoftware/smackx/jingle/JingleTest.java b/smack-extensions/src/test/java/org/jivesoftware/smackx/jingle/JingleTest.java index ce868738c..c7827e475 100644 --- a/smack-extensions/src/test/java/org/jivesoftware/smackx/jingle/JingleTest.java +++ b/smack-extensions/src/test/java/org/jivesoftware/smackx/jingle/JingleTest.java @@ -76,6 +76,6 @@ public class JingleTest extends SmackTestSuite { "action='session-initiate' " + "sid='" + sessionId + "'>" + ""; - assertTrue(jingle.toXML(null).toString().contains(xml)); + assertTrue(jingle.toXML().toString().contains(xml)); } } diff --git a/smack-extensions/src/test/java/org/jivesoftware/smackx/jingle/transports/jingle_ibb/JingleIBBTransportTest.java b/smack-extensions/src/test/java/org/jivesoftware/smackx/jingle/transports/jingle_ibb/JingleIBBTransportTest.java index 6a44cf3b7..e33b2b814 100644 --- a/smack-extensions/src/test/java/org/jivesoftware/smackx/jingle/transports/jingle_ibb/JingleIBBTransportTest.java +++ b/smack-extensions/src/test/java/org/jivesoftware/smackx/jingle/transports/jingle_ibb/JingleIBBTransportTest.java @@ -43,7 +43,7 @@ public class JingleIBBTransportTest extends SmackTestSuite { String xml = ""; JingleIBBTransport transport = new JingleIBBTransport(size, sid); - assertEquals(xml, transport.toXML(null).toString()); + assertEquals(xml, transport.toXML().toString()); assertEquals(size, transport.getBlockSize()); assertEquals(sid, transport.getSessionId()); @@ -51,7 +51,7 @@ public class JingleIBBTransportTest extends SmackTestSuite { .parse(TestUtils.getParser(xml)); assertEquals(transport, parsed); assertTrue(transport.equals(parsed)); - assertEquals(xml, parsed.toXML(null).toString()); + assertEquals(xml, parsed.toXML().toString()); JingleIBBTransport transport1 = new JingleIBBTransport((short) 1024); assertEquals((short) 1024, transport1.getBlockSize()); diff --git a/smack-extensions/src/test/java/org/jivesoftware/smackx/jingle/transports/jingle_s5b/JingleS5BTransportTest.java b/smack-extensions/src/test/java/org/jivesoftware/smackx/jingle/transports/jingle_s5b/JingleS5BTransportTest.java index fe5e1f119..68ca37f06 100644 --- a/smack-extensions/src/test/java/org/jivesoftware/smackx/jingle/transports/jingle_s5b/JingleS5BTransportTest.java +++ b/smack-extensions/src/test/java/org/jivesoftware/smackx/jingle/transports/jingle_s5b/JingleS5BTransportTest.java @@ -113,7 +113,7 @@ public class JingleS5BTransportTest extends SmackTestSuite { assertEquals(7878787, candidate3.getPriority()); assertEquals(JingleS5BTransportCandidate.Type.proxy, candidate3.getType()); - assertEquals(xml, transport.toXML(null).toString()); + assertEquals(xml, transport.toXML().toString()); } @Test @@ -129,7 +129,7 @@ public class JingleS5BTransportTest extends SmackTestSuite { assertEquals("vj3hs98y", candidateErrorTransport.getStreamId()); assertEquals(JingleS5BTransportInfo.CandidateError.INSTANCE, candidateErrorTransport.getInfo()); - assertEquals(candidateError, candidateErrorTransport.toXML(null).toString()); + assertEquals(candidateError, candidateErrorTransport.toXML().toString()); String proxyError = "" + @@ -143,7 +143,7 @@ public class JingleS5BTransportTest extends SmackTestSuite { assertEquals("vj3hs98y", proxyErrorTransport.getStreamId()); assertEquals(JingleS5BTransportInfo.ProxyError.INSTANCE, proxyErrorTransport.getInfo()); - assertEquals(proxyError, proxyErrorTransport.toXML(null).toString()); + assertEquals(proxyError, proxyErrorTransport.toXML().toString()); String candidateUsed = "" + @@ -157,7 +157,7 @@ public class JingleS5BTransportTest extends SmackTestSuite { assertEquals("hr65dqyd", ((JingleS5BTransportInfo.CandidateUsed) candidateUsedTransport.getInfo()).getCandidateId()); - assertEquals(candidateUsed, candidateUsedTransport.toXML(null).toString()); + assertEquals(candidateUsed, candidateUsedTransport.toXML().toString()); String candidateActivated = "" + @@ -173,7 +173,7 @@ public class JingleS5BTransportTest extends SmackTestSuite { assertEquals("hr65dqyd", ((JingleS5BTransportInfo.CandidateActivated) candidateActivatedTransport.getInfo()).getCandidateId()); - assertEquals(candidateActivated, candidateActivatedTransport.toXML(null).toString()); + assertEquals(candidateActivated, candidateActivatedTransport.toXML().toString()); } @Test(expected = IllegalArgumentException.class) @@ -216,7 +216,7 @@ public class JingleS5BTransportTest extends SmackTestSuite { assertEquals(host, candidate.getHost()); assertEquals(port, candidate.getPort()); - assertEquals(streamHost.toXML(null).toString(), candidate.getStreamHost().toXML(null).toString()); + assertEquals(streamHost.toXML().toString(), candidate.getStreamHost().toXML().toString()); } @Test(expected = IllegalArgumentException.class) diff --git a/smack-extensions/src/test/java/org/jivesoftware/smackx/last_interaction/IdleTest.java b/smack-extensions/src/test/java/org/jivesoftware/smackx/last_interaction/IdleTest.java index 3ef5eb7dc..59bee0cf0 100644 --- a/smack-extensions/src/test/java/org/jivesoftware/smackx/last_interaction/IdleTest.java +++ b/smack-extensions/src/test/java/org/jivesoftware/smackx/last_interaction/IdleTest.java @@ -44,7 +44,7 @@ public class IdleTest extends SmackTestSuite { assertEquals(date, parsed.getSince()); IdleElement element = new IdleElement(date); - assertXMLEqual("", element.toXML(null).toString()); + assertXMLEqual("", element.toXML().toString()); } @Test diff --git a/smack-extensions/src/test/java/org/jivesoftware/smackx/message_correct/MessageCorrectExtensionTest.java b/smack-extensions/src/test/java/org/jivesoftware/smackx/message_correct/MessageCorrectExtensionTest.java index 2cb16327b..5d6247e28 100644 --- a/smack-extensions/src/test/java/org/jivesoftware/smackx/message_correct/MessageCorrectExtensionTest.java +++ b/smack-extensions/src/test/java/org/jivesoftware/smackx/message_correct/MessageCorrectExtensionTest.java @@ -42,11 +42,11 @@ public class MessageCorrectExtensionTest { Message initialMessage = PacketParserUtils.parseStanza(initialMessageXml); MessageCorrectExtension messageCorrectExtension = new MessageCorrectExtension(idInitialMessage); - Assert.assertEquals(messageCorrectExtension.toXML(null).toString(), messageCorrectionXml.toString()); + Assert.assertEquals(messageCorrectExtension.toXML().toString(), messageCorrectionXml.toString()); initialMessage.addExtension(messageCorrectExtension); - Assert.assertEquals(initialMessage.toXML(null), expectedXml.toString()); + Assert.assertEquals(initialMessage.toXML().toString(), expectedXml.toString()); } } diff --git a/smack-extensions/src/test/java/org/jivesoftware/smackx/mood/MoodConcretisationTest.java b/smack-extensions/src/test/java/org/jivesoftware/smackx/mood/MoodConcretisationTest.java index 3f159cdeb..346b990bf 100644 --- a/smack-extensions/src/test/java/org/jivesoftware/smackx/mood/MoodConcretisationTest.java +++ b/smack-extensions/src/test/java/org/jivesoftware/smackx/mood/MoodConcretisationTest.java @@ -60,11 +60,11 @@ public class MoodConcretisationTest extends SmackTestSuite { new EcstaticMoodConcretisation()), "Yay, the mood spec has been approved!"); - assertXMLEqual(xml, element.toXML(null).toString()); + assertXMLEqual(xml, element.toXML().toString()); XmlPullParser parser = TestUtils.getParser(xml); MoodElement parsed = MoodProvider.INSTANCE.parse(parser); - assertXMLEqual(xml, parsed.toXML(null).toString()); + assertXMLEqual(xml, parsed.toXML().toString()); assertTrue(parsed.hasConcretisation()); assertTrue(parsed.hasText()); diff --git a/smack-extensions/src/test/java/org/jivesoftware/smackx/mood/MoodElementTest.java b/smack-extensions/src/test/java/org/jivesoftware/smackx/mood/MoodElementTest.java index b504ed98b..9916cfaf1 100644 --- a/smack-extensions/src/test/java/org/jivesoftware/smackx/mood/MoodElementTest.java +++ b/smack-extensions/src/test/java/org/jivesoftware/smackx/mood/MoodElementTest.java @@ -41,13 +41,13 @@ public class MoodElementTest extends SmackTestSuite { ""; MoodElement moodElement = new MoodElement(new MoodElement.MoodSubjectElement(Mood.happy, null), "Yay, the mood spec has been approved!"); - assertXMLEqual(xml, moodElement.toXML(null).toString()); + assertXMLEqual(xml, moodElement.toXML().toString()); assertFalse(moodElement.hasConcretisation()); assertEquals(Mood.happy, moodElement.getMood()); XmlPullParser parser = TestUtils.getParser(xml); MoodElement parsed = MoodProvider.INSTANCE.parse(parser); - assertEquals(xml, parsed.toXML(null).toString()); + assertEquals(xml, parsed.toXML().toString()); } @Test(expected = IllegalArgumentException.class) @@ -67,7 +67,7 @@ public class MoodElementTest extends SmackTestSuite { String xml = ""; XmlPullParser parser = TestUtils.getParser(xml); MoodElement emptyParsed = MoodProvider.INSTANCE.parse(parser); - assertEquals(empty.toXML(null).toString(), emptyParsed.toXML(null).toString()); + assertEquals(empty.toXML().toString(), emptyParsed.toXML().toString()); } @Test(expected = XmlPullParserException.class) diff --git a/smack-extensions/src/test/java/org/jivesoftware/smackx/pubsub/AffiliationsExtensionTest.java b/smack-extensions/src/test/java/org/jivesoftware/smackx/pubsub/AffiliationsExtensionTest.java index 9b0c52042..079733aab 100644 --- a/smack-extensions/src/test/java/org/jivesoftware/smackx/pubsub/AffiliationsExtensionTest.java +++ b/smack-extensions/src/test/java/org/jivesoftware/smackx/pubsub/AffiliationsExtensionTest.java @@ -40,7 +40,7 @@ public class AffiliationsExtensionTest { AffiliationsExtension affiliationsExtension = new AffiliationsExtension(affiliationsList, "testNode"); - CharSequence xml = affiliationsExtension.toXML(null); + CharSequence xml = affiliationsExtension.toXML(); assertXMLEqual("", xml.toString()); diff --git a/smack-extensions/src/test/java/org/jivesoftware/smackx/pubsub/ItemValidationTest.java b/smack-extensions/src/test/java/org/jivesoftware/smackx/pubsub/ItemValidationTest.java index ab1b38aae..1d81bf4c9 100644 --- a/smack-extensions/src/test/java/org/jivesoftware/smackx/pubsub/ItemValidationTest.java +++ b/smack-extensions/src/test/java/org/jivesoftware/smackx/pubsub/ItemValidationTest.java @@ -62,15 +62,15 @@ public class ItemValidationTest extends InitExtensions { public void verifyBasicItem() throws Exception { Item simpleItem = new Item(); String simpleCtrl = ""; - assertXMLEqual(simpleCtrl, simpleItem.toXML(null).toString()); + assertXMLEqual(simpleCtrl, simpleItem.toXML().toString()); Item idItem = new Item("uniqueid"); String idCtrl = ""; - assertXMLEqual(idCtrl, idItem.toXML(null).toString()); + assertXMLEqual(idCtrl, idItem.toXML().toString()); Item itemWithNodeId = new Item("testId", "testNode"); String nodeIdCtrl = ""; - assertXMLEqual(nodeIdCtrl, itemWithNodeId.toXML(null).toString()); + assertXMLEqual(nodeIdCtrl, itemWithNodeId.toXML().toString()); } @Test @@ -78,16 +78,16 @@ public class ItemValidationTest extends InitExtensions { SimplePayload payload = new SimplePayload("This is the payload"); PayloadItem simpleItem = new PayloadItem<>(payload); - String simpleCtrl = "" + payload.toXML(null) + ""; - assertXMLEqual(simpleCtrl, simpleItem.toXML(null).toString()); + String simpleCtrl = "" + payload.toXML() + ""; + assertXMLEqual(simpleCtrl, simpleItem.toXML().toString()); PayloadItem idItem = new PayloadItem<>("uniqueid", payload); - String idCtrl = "" + payload.toXML(null) + ""; - assertXMLEqual(idCtrl, idItem.toXML(null).toString()); + String idCtrl = "" + payload.toXML() + ""; + assertXMLEqual(idCtrl, idItem.toXML().toString()); PayloadItem itemWithNodeId = new PayloadItem<>("testId", "testNode", payload); - String nodeIdCtrl = "" + payload.toXML(null) + ""; - assertXMLEqual(nodeIdCtrl, itemWithNodeId.toXML(null).toString()); + String nodeIdCtrl = "" + payload.toXML() + ""; + assertXMLEqual(nodeIdCtrl, itemWithNodeId.toXML().toString()); } @Test @@ -145,7 +145,7 @@ public class ItemValidationTest extends InitExtensions { SimplePayload payload = (SimplePayload) item.getPayload(); assertEquals("foo", payload.getElementName()); assertEquals("smack:test", payload.getNamespace()); - assertXMLEqual(itemContent, payload.toXML(null).toString()); + assertXMLEqual(itemContent, payload.toXML().toString()); } @Test @@ -191,7 +191,7 @@ public class ItemValidationTest extends InitExtensions { SimplePayload payload = (SimplePayload) item.getPayload(); assertEquals("entry", payload.getElementName()); assertEquals("http://www.w3.org/2005/Atom", payload.getNamespace()); - assertXMLEqual(itemContent, payload.toXML(null).toString()); + assertXMLEqual(itemContent, payload.toXML().toString()); } @Test @@ -226,6 +226,6 @@ public class ItemValidationTest extends InitExtensions { assertEquals("testid1", item.getId()); assertTrue(item.getPayload() instanceof SimplePayload); - assertXMLEqual(itemContent, item.getPayload().toXML(null).toString()); + assertXMLEqual(itemContent, item.getPayload().toXML().toString()); } } diff --git a/smack-extensions/src/test/java/org/jivesoftware/smackx/pubsub/PubSubNodeTest.java b/smack-extensions/src/test/java/org/jivesoftware/smackx/pubsub/PubSubNodeTest.java index 4c8496725..3d2341a9b 100644 --- a/smack-extensions/src/test/java/org/jivesoftware/smackx/pubsub/PubSubNodeTest.java +++ b/smack-extensions/src/test/java/org/jivesoftware/smackx/pubsub/PubSubNodeTest.java @@ -61,7 +61,7 @@ public class PubSubNodeTest extends SmackTestSuite { assertEquals("http://jabber.org/protocol/pubsub#owner", request.getChildElementNamespace()); assertEquals("pubsub", request.getChildElementName()); - XmlPullParser parser = TestUtils.getIQParser(request.toXML(null).toString()); + XmlPullParser parser = TestUtils.getIQParser(request.toXML().toString()); PubSub pubsubResult = (PubSub) PacketParserUtils.parseIQ(parser); SubscriptionsExtension subElem = pubsubResult.getExtension(PubSubElementType.SUBSCRIPTIONS_OWNER); List subscriptions = subElem.getSubscriptions(); diff --git a/smack-extensions/src/test/java/org/jivesoftware/smackx/pubsub/SimplePayloadTest.java b/smack-extensions/src/test/java/org/jivesoftware/smackx/pubsub/SimplePayloadTest.java index 2bb046ad4..fd6050e2a 100644 --- a/smack-extensions/src/test/java/org/jivesoftware/smackx/pubsub/SimplePayloadTest.java +++ b/smack-extensions/src/test/java/org/jivesoftware/smackx/pubsub/SimplePayloadTest.java @@ -29,6 +29,6 @@ public class SimplePayloadTest { assertEquals("element", simplePayload.getElementName()); assertEquals("https://example.org", simplePayload.getNamespace()); - assertEquals(xmlPayload, simplePayload.toXML(null)); + assertEquals(xmlPayload, simplePayload.toXML().toString()); } } diff --git a/smack-extensions/src/test/java/org/jivesoftware/smackx/xdata/packet/DataFormTest.java b/smack-extensions/src/test/java/org/jivesoftware/smackx/xdata/packet/DataFormTest.java index 58e17b078..5500125e9 100644 --- a/smack-extensions/src/test/java/org/jivesoftware/smackx/xdata/packet/DataFormTest.java +++ b/smack-extensions/src/test/java/org/jivesoftware/smackx/xdata/packet/DataFormTest.java @@ -57,8 +57,8 @@ public class DataFormTest { FormField field = new FormField("testField1"); df.addField(field); - assertNotNull(df.toXML(null)); - String output = df.toXML(null).toString(); + assertNotNull(df.toXML()); + String output = df.toXML().toString(); assertEquals(TEST_OUTPUT_1, output); XmlPullParser parser = PacketParserUtils.getParserFor(output); @@ -70,8 +70,8 @@ public class DataFormTest { assertEquals(1 , df.getFields().size()); assertEquals(1 , df.getInstructions().size()); - assertNotNull(df.toXML(null)); - output = df.toXML(null).toString(); + assertNotNull(df.toXML()); + output = df.toXML().toString(); assertEquals(TEST_OUTPUT_1, output); } @@ -95,8 +95,8 @@ public class DataFormTest { df.addExtensionElement(layout); - assertNotNull(df.toXML(null)); - String output = df.toXML(null).toString(); + assertNotNull(df.toXML()); + String output = df.toXML().toString(); assertEquals(TEST_OUTPUT_2, output); XmlPullParser parser = PacketParserUtils.getParserFor(output); @@ -112,8 +112,8 @@ public class DataFormTest { assertEquals(3 , layout.getPageLayout().size()); - assertNotNull(df.toXML(null)); - output = df.toXML(null).toString(); + assertNotNull(df.toXML()); + output = df.toXML().toString(); assertEquals(TEST_OUTPUT_2, output); } @@ -129,8 +129,8 @@ public class DataFormTest { ValidateElement dv = new RangeValidateElement("xs:integer","1111", "9999"); field.setValidateElement(dv); - assertNotNull(df.toXML(null)); - String output = df.toXML(null).toString(); + assertNotNull(df.toXML()); + String output = df.toXML().toString(); assertEquals(TEST_OUTPUT_3, output); XmlPullParser parser = PacketParserUtils.getParserFor(output); @@ -146,8 +146,8 @@ public class DataFormTest { assertEquals("xs:integer" , dv.getDatatype()); - assertNotNull(df.toXML(null)); - output = df.toXML(null).toString(); + assertNotNull(df.toXML()); + output = df.toXML().toString(); assertEquals(TEST_OUTPUT_3, output); } diff --git a/smack-extensions/src/test/java/org/jivesoftware/smackx/xdatalayout/packet/DataLayoutTest.java b/smack-extensions/src/test/java/org/jivesoftware/smackx/xdatalayout/packet/DataLayoutTest.java index 9dcc5e113..08820fc2f 100644 --- a/smack-extensions/src/test/java/org/jivesoftware/smackx/xdatalayout/packet/DataLayoutTest.java +++ b/smack-extensions/src/test/java/org/jivesoftware/smackx/xdatalayout/packet/DataLayoutTest.java @@ -80,8 +80,8 @@ public class DataLayoutTest { layout.getPageLayout().add(section); layout.getPageLayout().add(new Text("PageText")); - assertNotNull(layout.toXML(null)); - String output = layout.toXML(null).toString(); + assertNotNull(layout.toXML()); + String output = layout.toXML().toString(); assertEquals(TEST_OUTPUT_2, output); XmlPullParser parser = PacketParserUtils.getParserFor(output); @@ -91,8 +91,8 @@ public class DataLayoutTest { assertEquals(3 , layout.getPageLayout().size()); assertEquals("Label", layout.getLabel()); - assertNotNull(layout.toXML(null)); - output = layout.toXML(null).toString(); + assertNotNull(layout.toXML()); + output = layout.toXML().toString(); assertEquals(TEST_OUTPUT_2, output); } @@ -114,8 +114,8 @@ public class DataLayoutTest { layout.getPageLayout().add(new Text("DO NOT DELAY
supply further information")); - assertNotNull(layout.toXML(null)); - String output = layout.toXML(null).toString(); + assertNotNull(layout.toXML()); + String output = layout.toXML().toString(); assertEquals(TEST_OUTPUT_SPECIAL, output); XmlPullParser parser = PacketParserUtils.getParserFor(output); @@ -134,8 +134,8 @@ public class DataLayoutTest { assertEquals("DO NOT DELAY
supply further information", text.getText()); - assertNotNull(layout.toXML(null)); - output = layout.toXML(null).toString(); + assertNotNull(layout.toXML()); + output = layout.toXML().toString(); assertEquals(TEST_OUTPUT_SPECIAL, output); } @@ -165,8 +165,8 @@ public class DataLayoutTest { assertEquals("DO NOT DELAY
supply further information", text.getText()); - assertNotNull(layout.toXML(null)); - String output = layout.toXML(null).toString(); + assertNotNull(layout.toXML()); + String output = layout.toXML().toString(); assertEquals(TEST_OUTPUT_SPECIAL, output); } } diff --git a/smack-extensions/src/test/java/org/jivesoftware/smackx/xdatavalidation/provider/DataValidationTest.java b/smack-extensions/src/test/java/org/jivesoftware/smackx/xdatavalidation/provider/DataValidationTest.java index 92641d57e..e8e272d05 100644 --- a/smack-extensions/src/test/java/org/jivesoftware/smackx/xdatavalidation/provider/DataValidationTest.java +++ b/smack-extensions/src/test/java/org/jivesoftware/smackx/xdatavalidation/provider/DataValidationTest.java @@ -52,8 +52,8 @@ public class DataValidationTest { ValidateElement dv = new BasicValidateElement(null); - assertNotNull(dv.toXML(null)); - String output = dv.toXML(null).toString(); + assertNotNull(dv.toXML()); + String output = dv.toXML().toString(); assertEquals(TEST_OUTPUT_MIN, output); XmlPullParser parser = getParser(TEST_INPUT_MIN); @@ -64,8 +64,8 @@ public class DataValidationTest { assertEquals("xs:string", dv.getDatatype()); assertTrue(dv instanceof BasicValidateElement); - assertNotNull(dv.toXML(null)); - output = dv.toXML(null).toString(); + assertNotNull(dv.toXML()); + output = dv.toXML().toString(); assertEquals(TEST_OUTPUT_MIN, output); } @@ -77,8 +77,8 @@ public class DataValidationTest { ListRange listRange = new ListRange(111L, 999L); dv.setListRange(listRange); - assertNotNull(dv.toXML(null)); - String output = dv.toXML(null).toString(); + assertNotNull(dv.toXML()); + String output = dv.toXML().toString(); assertEquals(TEST_OUTPUT_RANGE, output); XmlPullParser parser = getParser(output); @@ -96,8 +96,8 @@ public class DataValidationTest { assertEquals(999, rdv.getListRange().getMax().intValue()); - assertNotNull(dv.toXML(null)); - output = dv.toXML(null).toString(); + assertNotNull(dv.toXML()); + output = dv.toXML().toString(); assertEquals(TEST_OUTPUT_RANGE, output); } @@ -106,8 +106,8 @@ public class DataValidationTest { ValidateElement dv = new RangeValidateElement(null, null, null); - assertNotNull(dv.toXML(null)); - String output = dv.toXML(null).toString(); + assertNotNull(dv.toXML()); + String output = dv.toXML().toString(); assertEquals(TEST_OUTPUT_RANGE2, output); XmlPullParser parser = getParser(output); @@ -121,8 +121,8 @@ public class DataValidationTest { assertEquals(null, rdv.getMin()); assertEquals(null, rdv.getMax()); - assertNotNull(rdv.toXML(null)); - output = rdv.toXML(null).toString(); + assertNotNull(rdv.toXML()); + output = rdv.toXML().toString(); assertEquals(TEST_OUTPUT_RANGE2, output); } diff --git a/smack-extensions/src/test/java/org/jivesoftware/util/Protocol.java b/smack-extensions/src/test/java/org/jivesoftware/util/Protocol.java index 2c9a3084a..5794d7e3c 100644 --- a/smack-extensions/src/test/java/org/jivesoftware/util/Protocol.java +++ b/smack-extensions/src/test/java/org/jivesoftware/util/Protocol.java @@ -131,10 +131,10 @@ public class Protocol { if (printProtocol) { System.out.println("------------------- Request -------------\n"); - System.out.println(XmlUtil.prettyFormatXml(request.toXML(null))); + System.out.println(XmlUtil.prettyFormatXml(request.toXML())); System.out.println("------------------- Response ------------\n"); if (response != null) { - System.out.println(XmlUtil.prettyFormatXml(response.toXML(null))); + System.out.println(XmlUtil.prettyFormatXml(response.toXML())); } else { System.out.println("No response"); diff --git a/smack-im/src/main/java/org/jivesoftware/smack/chat/ChatManager.java b/smack-im/src/main/java/org/jivesoftware/smack/chat/ChatManager.java index a811fe1f3..77070934a 100644 --- a/smack-im/src/main/java/org/jivesoftware/smack/chat/ChatManager.java +++ b/smack-im/src/main/java/org/jivesoftware/smack/chat/ChatManager.java @@ -294,7 +294,7 @@ public final class ChatManager extends Manager{ EntityJid userJID = from.asEntityJidIfPossible(); if (userJID == null) { - LOGGER.warning("Message from JID without localpart: '" + message.toXML(null) + "'"); + LOGGER.warning("Message from JID without localpart: '" + message.toXML() + "'"); return null; } String threadID = message.getThread(); diff --git a/smack-im/src/main/java/org/jivesoftware/smack/roster/packet/RosterPacket.java b/smack-im/src/main/java/org/jivesoftware/smack/roster/packet/RosterPacket.java index 66ed9c6d7..12a751aec 100644 --- a/smack-im/src/main/java/org/jivesoftware/smack/roster/packet/RosterPacket.java +++ b/smack-im/src/main/java/org/jivesoftware/smack/roster/packet/RosterPacket.java @@ -91,7 +91,7 @@ public final class RosterPacket extends IQ { synchronized (rosterItems) { for (Item entry : rosterItems) { - buf.append(entry.toXML(null)); + buf.append(entry.toXML()); } } return buf; @@ -272,7 +272,7 @@ public final class RosterPacket extends IQ { } @Override - public XmlStringBuilder toXML(String enclosingNamespace) { + public XmlStringBuilder toXML(org.jivesoftware.smack.packet.XmlEnvironment enclosingNamespace) { XmlStringBuilder xml = new XmlStringBuilder(this); xml.attribute("jid", jid); xml.optAttribute("name", name); diff --git a/smack-im/src/main/java/org/jivesoftware/smack/roster/packet/RosterVer.java b/smack-im/src/main/java/org/jivesoftware/smack/roster/packet/RosterVer.java index 17061253b..cf3ec9eb1 100644 --- a/smack-im/src/main/java/org/jivesoftware/smack/roster/packet/RosterVer.java +++ b/smack-im/src/main/java/org/jivesoftware/smack/roster/packet/RosterVer.java @@ -40,7 +40,7 @@ public final class RosterVer implements ExtensionElement { } @Override - public XmlStringBuilder toXML(String enclosingNamespace) { + public XmlStringBuilder toXML(org.jivesoftware.smack.packet.XmlEnvironment enclosingNamespace) { XmlStringBuilder xml = new XmlStringBuilder(this); xml.closeEmptyElement(); return xml; diff --git a/smack-im/src/main/java/org/jivesoftware/smack/roster/packet/SubscriptionPreApproval.java b/smack-im/src/main/java/org/jivesoftware/smack/roster/packet/SubscriptionPreApproval.java index 426526937..2008d8694 100644 --- a/smack-im/src/main/java/org/jivesoftware/smack/roster/packet/SubscriptionPreApproval.java +++ b/smack-im/src/main/java/org/jivesoftware/smack/roster/packet/SubscriptionPreApproval.java @@ -40,7 +40,7 @@ public final class SubscriptionPreApproval implements ExtensionElement { } @Override - public XmlStringBuilder toXML(String enclosingNamespace) { + public XmlStringBuilder toXML(org.jivesoftware.smack.packet.XmlEnvironment enclosingNamespace) { XmlStringBuilder xml = new XmlStringBuilder(this); xml.closeEmptyElement(); return xml; diff --git a/smack-im/src/main/java/org/jivesoftware/smack/roster/rosterstore/DirectoryRosterStore.java b/smack-im/src/main/java/org/jivesoftware/smack/roster/rosterstore/DirectoryRosterStore.java index 933d2dd25..473777569 100644 --- a/smack-im/src/main/java/org/jivesoftware/smack/roster/rosterstore/DirectoryRosterStore.java +++ b/smack-im/src/main/java/org/jivesoftware/smack/roster/rosterstore/DirectoryRosterStore.java @@ -213,7 +213,7 @@ public final class DirectoryRosterStore implements RosterStore { } private boolean addEntryRaw (Item item) { - return FileUtils.writeFile(getBareJidFile(item.getJid()), item.toXML(null)); + return FileUtils.writeFile(getBareJidFile(item.getJid()), item.toXML()); } private File getBareJidFile(Jid bareJid) { diff --git a/smack-integration-test/src/main/java/org/jivesoftware/smackx/caps/EntityCapsTest.java b/smack-integration-test/src/main/java/org/jivesoftware/smackx/caps/EntityCapsTest.java index 17520f114..3dcbc8161 100644 --- a/smack-integration-test/src/main/java/org/jivesoftware/smackx/caps/EntityCapsTest.java +++ b/smack-integration-test/src/main/java/org/jivesoftware/smackx/caps/EntityCapsTest.java @@ -217,7 +217,7 @@ public class EntityCapsTest extends AbstractSmackIntegrationTest { DiscoverInfo entityInfo = EntityCapsManager.CAPS_CACHE.lookup(u1ver); assertNotNull(entityInfo); - assertEquals(info.toXML(null), entityInfo.toXML(null)); + assertEquals(info.toXML().toString(), entityInfo.toXML().toString()); } private static void dropWholeEntityCapsCache() { diff --git a/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/JingleSession.java b/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/JingleSession.java index 1b3ee5e41..84f679c1e 100644 --- a/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/JingleSession.java +++ b/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/JingleSession.java @@ -288,7 +288,7 @@ public final class JingleSession extends JingleNegotiator implements MediaReceiv String responseId; - LOGGER.fine("Packet: " + iq.toXML(null)); + LOGGER.fine("Packet: " + iq.toXML()); try { @@ -718,21 +718,21 @@ public final class JingleSession extends JingleNegotiator implements MediaReceiv String sid = jin.getSid(); if (sid == null || !sid.equals(getSid())) { - LOGGER.fine("Ignored Jingle(SID) " + sid + "|" + getSid() + " :" + iq.toXML(null)); + LOGGER.fine("Ignored Jingle(SID) " + sid + "|" + getSid() + " :" + iq.toXML()); return false; } Jid ini = jin.getInitiator(); if (!ini.equals(getInitiator())) { - LOGGER.fine("Ignored Jingle(INI): " + iq.toXML(null)); + LOGGER.fine("Ignored Jingle(INI): " + iq.toXML()); return false; } } else { // We accept some non-Jingle IQ packets: ERRORs and ACKs if (iq.getType().equals(IQ.Type.set)) { - LOGGER.fine("Ignored Jingle(TYPE): " + iq.toXML(null)); + LOGGER.fine("Ignored Jingle(TYPE): " + iq.toXML()); return false; } else if (iq.getType().equals(IQ.Type.get)) { - LOGGER.fine("Ignored Jingle(TYPE): " + iq.toXML(null)); + LOGGER.fine("Ignored Jingle(TYPE): " + iq.toXML()); return false; } } @@ -1062,7 +1062,7 @@ public final class JingleSession extends JingleNegotiator implements MediaReceiv // NO! Let the normal state machinery do all of the sending. // getConnection().sendStanza(perror); - LOGGER.severe("Error sent: " + errorPacket.toXML(null)); + LOGGER.severe("Error sent: " + errorPacket.toXML()); } return errorPacket; } diff --git a/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/packet/Jingle.java b/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/packet/Jingle.java index acc7295dd..7712a3474 100644 --- a/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/packet/Jingle.java +++ b/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/packet/Jingle.java @@ -363,13 +363,13 @@ public class Jingle extends IQ { synchronized (contents) { for (JingleContent content : contents) { - buf.append(content.toXML(null)); + buf.append(content.toXML()); } } // and the same for audio jmf info if (contentInfo != null) { - buf.append(contentInfo.toXML(null)); + buf.append(contentInfo.toXML()); } return buf; diff --git a/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/packet/JingleContent.java b/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/packet/JingleContent.java index d681e40e3..6506b9de8 100644 --- a/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/packet/JingleContent.java +++ b/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/packet/JingleContent.java @@ -160,7 +160,7 @@ public class JingleContent implements ExtensionElement { * @return a string with the XML representation */ @Override - public String toXML(String enclosingNamespace) { + public String toXML(org.jivesoftware.smack.packet.XmlEnvironment enclosingNamespace) { StringBuilder buf = new StringBuilder(); synchronized (transports) { @@ -171,12 +171,12 @@ public class JingleContent implements ExtensionElement { // Add the description. if (description != null) { - buf.append(description.toXML(null)); + buf.append(description.toXML()); } // Add all of the transports. for (JingleTransport transport : transports) { - buf.append(transport.toXML(null)); + buf.append(transport.toXML()); } buf.append("'); } diff --git a/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/packet/JingleContentDescription.java b/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/packet/JingleContentDescription.java index f09969fd0..01cbcb8ea 100644 --- a/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/packet/JingleContentDescription.java +++ b/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/packet/JingleContentDescription.java @@ -148,7 +148,7 @@ public abstract class JingleContentDescription implements ExtensionElement { * @return a string with the XML representation */ @Override - public String toXML(String enclosingNamespace) { + public String toXML(org.jivesoftware.smack.packet.XmlEnvironment enclosingNamespace) { StringBuilder buf = new StringBuilder(); synchronized (payloads) { diff --git a/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/packet/JingleContentInfo.java b/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/packet/JingleContentInfo.java index acd85e6c5..9d5d7795b 100644 --- a/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/packet/JingleContentInfo.java +++ b/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/packet/JingleContentInfo.java @@ -84,7 +84,7 @@ public class JingleContentInfo implements ExtensionElement { } @Override - public String toXML(String enclosingNamespace) { + public String toXML(org.jivesoftware.smack.packet.XmlEnvironment enclosingNamespace) { StringBuilder buf = new StringBuilder(); buf.append('<').append(getElementName()).append(" xmlns=\""); buf.append(getNamespace()).append("\" "); diff --git a/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/packet/JingleDescription.java b/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/packet/JingleDescription.java index ac291426a..57e9450a1 100644 --- a/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/packet/JingleDescription.java +++ b/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/packet/JingleDescription.java @@ -155,7 +155,7 @@ public abstract class JingleDescription implements ExtensionElement { * @return a string with the XML representation */ @Override - public String toXML(String enclosingNamespace) { + public String toXML(org.jivesoftware.smack.packet.XmlEnvironment enclosingNamespace) { StringBuilder buf = new StringBuilder(); synchronized (payloads) { diff --git a/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/packet/JingleError.java b/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/packet/JingleError.java index 1559bfac1..c67f6e190 100644 --- a/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/packet/JingleError.java +++ b/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/packet/JingleError.java @@ -76,7 +76,7 @@ public class JingleError implements ExtensionElement { * @return the error as XML. */ @Override - public String toXML(String enclosingNamespace) { + public String toXML(org.jivesoftware.smack.packet.XmlEnvironment enclosingNamespace) { StringBuilder buf = new StringBuilder(); if (message != null) { buf.append(""); diff --git a/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/packet/JingleTransport.java b/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/packet/JingleTransport.java index 6ba7cddab..07cafdd3b 100644 --- a/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/packet/JingleTransport.java +++ b/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/packet/JingleTransport.java @@ -152,7 +152,7 @@ public class JingleTransport implements ExtensionElement { * Return the XML representation for this element. */ @Override - public String toXML(String enclosingNamespace) { + public String toXML(org.jivesoftware.smack.packet.XmlEnvironment enclosingNamespace) { StringBuilder buf = new StringBuilder(); buf.append('<').append(getElementName()).append(" xmlns=\""); diff --git a/smack-legacy/src/main/java/org/jivesoftware/smackx/workgroup/MetaData.java b/smack-legacy/src/main/java/org/jivesoftware/smackx/workgroup/MetaData.java index 53ecdb542..17332955a 100644 --- a/smack-legacy/src/main/java/org/jivesoftware/smackx/workgroup/MetaData.java +++ b/smack-legacy/src/main/java/org/jivesoftware/smackx/workgroup/MetaData.java @@ -64,7 +64,7 @@ public class MetaData implements ExtensionElement { } @Override - public String toXML(String enclosingNamespace) { + public String toXML(org.jivesoftware.smack.packet.XmlEnvironment enclosingNamespace) { return MetaDataUtils.serializeMetaData(this.getMetaData()); } } diff --git a/smack-legacy/src/main/java/org/jivesoftware/smackx/workgroup/agent/AgentRoster.java b/smack-legacy/src/main/java/org/jivesoftware/smackx/workgroup/agent/AgentRoster.java index 97fc97914..b6082bf40 100644 --- a/smack-legacy/src/main/java/org/jivesoftware/smackx/workgroup/agent/AgentRoster.java +++ b/smack-legacy/src/main/java/org/jivesoftware/smackx/workgroup/agent/AgentRoster.java @@ -299,7 +299,7 @@ public class AgentRoster { EntityFullJid from = presence.getFrom().asEntityFullJidIfPossible(); if (from == null) { // TODO Check if we need to ignore these presences or this is a server bug? - LOGGER.warning("Presence with non full JID from: " + presence.toXML(null)); + LOGGER.warning("Presence with non full JID from: " + presence.toXML()); return; } Jid key = getPresenceMapKey(from); diff --git a/smack-legacy/src/main/java/org/jivesoftware/smackx/workgroup/packet/AgentStatus.java b/smack-legacy/src/main/java/org/jivesoftware/smackx/workgroup/packet/AgentStatus.java index 873678f85..f4b4ad26d 100644 --- a/smack-legacy/src/main/java/org/jivesoftware/smackx/workgroup/packet/AgentStatus.java +++ b/smack-legacy/src/main/java/org/jivesoftware/smackx/workgroup/packet/AgentStatus.java @@ -95,7 +95,7 @@ public class AgentStatus implements ExtensionElement { } @Override - public String toXML(String enclosingNamespace) { + public String toXML(org.jivesoftware.smack.packet.XmlEnvironment enclosingNamespace) { StringBuilder buf = new StringBuilder(); buf.append('<').append(ELEMENT_NAME).append(" xmlns=\"").append(NAMESPACE).append('"'); diff --git a/smack-legacy/src/main/java/org/jivesoftware/smackx/workgroup/packet/OfferRevokeProvider.java b/smack-legacy/src/main/java/org/jivesoftware/smackx/workgroup/packet/OfferRevokeProvider.java index 6f2ed224b..2486e9043 100644 --- a/smack-legacy/src/main/java/org/jivesoftware/smackx/workgroup/packet/OfferRevokeProvider.java +++ b/smack-legacy/src/main/java/org/jivesoftware/smackx/workgroup/packet/OfferRevokeProvider.java @@ -107,10 +107,10 @@ public class OfferRevokeProvider extends IQProvider { buf.append("").append(reason).append(""); } if (sessionID != null) { - buf.append(new SessionID(sessionID).toXML(null)); + buf.append(new SessionID(sessionID).toXML()); } if (userID != null) { - buf.append(new UserID(userID).toXML(null)); + buf.append(new UserID(userID).toXML()); } return buf; } diff --git a/smack-legacy/src/main/java/org/jivesoftware/smackx/workgroup/packet/QueueDetails.java b/smack-legacy/src/main/java/org/jivesoftware/smackx/workgroup/packet/QueueDetails.java index f94d13ee5..fa6e277e0 100644 --- a/smack-legacy/src/main/java/org/jivesoftware/smackx/workgroup/packet/QueueDetails.java +++ b/smack-legacy/src/main/java/org/jivesoftware/smackx/workgroup/packet/QueueDetails.java @@ -104,7 +104,7 @@ public final class QueueDetails implements ExtensionElement { } @Override - public String toXML(String enclosingNamespace) { + public String toXML(org.jivesoftware.smack.packet.XmlEnvironment enclosingNamespace) { StringBuilder buf = new StringBuilder(); buf.append('<').append(ELEMENT_NAME).append(" xmlns=\"").append(NAMESPACE).append("\">"); diff --git a/smack-legacy/src/main/java/org/jivesoftware/smackx/workgroup/packet/QueueOverview.java b/smack-legacy/src/main/java/org/jivesoftware/smackx/workgroup/packet/QueueOverview.java index 29e74156c..eb722b579 100644 --- a/smack-legacy/src/main/java/org/jivesoftware/smackx/workgroup/packet/QueueOverview.java +++ b/smack-legacy/src/main/java/org/jivesoftware/smackx/workgroup/packet/QueueOverview.java @@ -24,6 +24,7 @@ import java.util.Date; import org.jivesoftware.smack.SmackException; import org.jivesoftware.smack.packet.ExtensionElement; +import org.jivesoftware.smack.packet.XmlEnvironment; import org.jivesoftware.smack.provider.ExtensionElementProvider; import org.jivesoftware.smackx.workgroup.agent.WorkgroupQueue; @@ -101,7 +102,7 @@ public class QueueOverview implements ExtensionElement { } @Override - public String toXML (String enclosingNamespace) { + public String toXML(XmlEnvironment enclosingEnvironment) { StringBuilder buf = new StringBuilder(); buf.append('<').append(ELEMENT_NAME).append(" xmlns=\"").append(NAMESPACE).append("\">"); diff --git a/smack-legacy/src/main/java/org/jivesoftware/smackx/workgroup/packet/QueueUpdate.java b/smack-legacy/src/main/java/org/jivesoftware/smackx/workgroup/packet/QueueUpdate.java index 05f90ffd2..cce62fba8 100644 --- a/smack-legacy/src/main/java/org/jivesoftware/smackx/workgroup/packet/QueueUpdate.java +++ b/smack-legacy/src/main/java/org/jivesoftware/smackx/workgroup/packet/QueueUpdate.java @@ -71,7 +71,7 @@ public class QueueUpdate implements ExtensionElement { } @Override - public String toXML(String enclosingNamespace) { + public String toXML(org.jivesoftware.smack.packet.XmlEnvironment enclosingNamespace) { StringBuilder buf = new StringBuilder(); buf.append(""); if (position != -1) { diff --git a/smack-legacy/src/main/java/org/jivesoftware/smackx/workgroup/packet/RoomInvitation.java b/smack-legacy/src/main/java/org/jivesoftware/smackx/workgroup/packet/RoomInvitation.java index 296111a1e..f190c8cd6 100644 --- a/smack-legacy/src/main/java/org/jivesoftware/smackx/workgroup/packet/RoomInvitation.java +++ b/smack-legacy/src/main/java/org/jivesoftware/smackx/workgroup/packet/RoomInvitation.java @@ -112,7 +112,7 @@ public class RoomInvitation implements ExtensionElement { } @Override - public XmlStringBuilder toXML(String enclosingNamespace) { + public XmlStringBuilder toXML(org.jivesoftware.smack.packet.XmlEnvironment enclosingNamespace) { XmlStringBuilder xml = getIQChildElementBuilder(new IQChildElementXmlStringBuilder(this)); xml.closeElement(this); return xml; diff --git a/smack-legacy/src/main/java/org/jivesoftware/smackx/workgroup/packet/RoomTransfer.java b/smack-legacy/src/main/java/org/jivesoftware/smackx/workgroup/packet/RoomTransfer.java index 234f8eb9c..c43a83e57 100644 --- a/smack-legacy/src/main/java/org/jivesoftware/smackx/workgroup/packet/RoomTransfer.java +++ b/smack-legacy/src/main/java/org/jivesoftware/smackx/workgroup/packet/RoomTransfer.java @@ -108,7 +108,7 @@ public class RoomTransfer implements ExtensionElement { } @Override - public XmlStringBuilder toXML(String enclosingNamespace) { + public XmlStringBuilder toXML(org.jivesoftware.smack.packet.XmlEnvironment enclosingNamespace) { XmlStringBuilder xml = getIQChildElementBuilder(new IQChildElementXmlStringBuilder(this)); xml.closeElement(this); return xml; diff --git a/smack-legacy/src/main/java/org/jivesoftware/smackx/workgroup/packet/SessionID.java b/smack-legacy/src/main/java/org/jivesoftware/smackx/workgroup/packet/SessionID.java index 9e19c6c04..018a84685 100644 --- a/smack-legacy/src/main/java/org/jivesoftware/smackx/workgroup/packet/SessionID.java +++ b/smack-legacy/src/main/java/org/jivesoftware/smackx/workgroup/packet/SessionID.java @@ -58,7 +58,7 @@ public class SessionID implements ExtensionElement { } @Override - public String toXML(String enclosingNamespace) { + public String toXML(org.jivesoftware.smack.packet.XmlEnvironment enclosingNamespace) { StringBuilder buf = new StringBuilder(); buf.append('<').append(ELEMENT_NAME).append(" xmlns=\"").append(NAMESPACE).append("\" "); diff --git a/smack-legacy/src/main/java/org/jivesoftware/smackx/workgroup/packet/Transcript.java b/smack-legacy/src/main/java/org/jivesoftware/smackx/workgroup/packet/Transcript.java index bc9569d41..4dd6d27d6 100644 --- a/smack-legacy/src/main/java/org/jivesoftware/smackx/workgroup/packet/Transcript.java +++ b/smack-legacy/src/main/java/org/jivesoftware/smackx/workgroup/packet/Transcript.java @@ -83,7 +83,7 @@ public class Transcript extends IQ { .append("\">"); for (Stanza packet : packets) { - buf.append(packet.toXML(null)); + buf.append(packet.toXML()); } return buf; diff --git a/smack-legacy/src/main/java/org/jivesoftware/smackx/workgroup/packet/UserID.java b/smack-legacy/src/main/java/org/jivesoftware/smackx/workgroup/packet/UserID.java index 9203a33fd..8e74bcfad 100644 --- a/smack-legacy/src/main/java/org/jivesoftware/smackx/workgroup/packet/UserID.java +++ b/smack-legacy/src/main/java/org/jivesoftware/smackx/workgroup/packet/UserID.java @@ -60,7 +60,7 @@ public class UserID implements ExtensionElement { } @Override - public String toXML(String enclosingNamespace) { + public String toXML(org.jivesoftware.smack.packet.XmlEnvironment enclosingNamespace) { StringBuilder buf = new StringBuilder(); buf.append('<').append(ELEMENT_NAME).append(" xmlns=\"").append(NAMESPACE).append("\" "); diff --git a/smack-legacy/src/main/java/org/jivesoftware/smackx/workgroup/packet/WorkgroupInformation.java b/smack-legacy/src/main/java/org/jivesoftware/smackx/workgroup/packet/WorkgroupInformation.java index d5a367e78..40a0dfb97 100644 --- a/smack-legacy/src/main/java/org/jivesoftware/smackx/workgroup/packet/WorkgroupInformation.java +++ b/smack-legacy/src/main/java/org/jivesoftware/smackx/workgroup/packet/WorkgroupInformation.java @@ -64,7 +64,7 @@ public class WorkgroupInformation implements ExtensionElement { } @Override - public String toXML(String enclosingNamespace) { + public String toXML(org.jivesoftware.smack.packet.XmlEnvironment enclosingNamespace) { StringBuilder buf = new StringBuilder(); buf.append('<').append(ELEMENT_NAME); diff --git a/smack-legacy/src/main/java/org/jivesoftware/smackx/workgroup/user/Workgroup.java b/smack-legacy/src/main/java/org/jivesoftware/smackx/workgroup/user/Workgroup.java index 2e7924a89..4b6a0288e 100644 --- a/smack-legacy/src/main/java/org/jivesoftware/smackx/workgroup/user/Workgroup.java +++ b/smack-legacy/src/main/java/org/jivesoftware/smackx/workgroup/user/Workgroup.java @@ -587,11 +587,11 @@ public class Workgroup { buf.append(""); // Add the user unique identification if the session is anonymous if (connection.isAnonymous()) { - buf.append(new UserID(userID).toXML(null)); + buf.append(new UserID(userID).toXML()); } // Append data form text - buf.append(form.toXML(null)); + buf.append(form.toXML()); return buf; } diff --git a/smack-legacy/src/main/java/org/jivesoftware/smackx/xevent/packet/MessageEvent.java b/smack-legacy/src/main/java/org/jivesoftware/smackx/xevent/packet/MessageEvent.java index 9441a50e1..39057d5e7 100644 --- a/smack-legacy/src/main/java/org/jivesoftware/smackx/xevent/packet/MessageEvent.java +++ b/smack-legacy/src/main/java/org/jivesoftware/smackx/xevent/packet/MessageEvent.java @@ -306,7 +306,7 @@ public class MessageEvent implements ExtensionElement { * */ @Override - public String toXML(String enclosingNamespace) { + public String toXML(org.jivesoftware.smack.packet.XmlEnvironment enclosingNamespace) { StringBuilder buf = new StringBuilder(); buf.append('<').append(getElementName()).append(" xmlns=\"").append(getNamespace()).append( "\">"); diff --git a/smack-legacy/src/main/java/org/jivesoftware/smackx/xroster/packet/RosterExchange.java b/smack-legacy/src/main/java/org/jivesoftware/smackx/xroster/packet/RosterExchange.java index efef31159..6c2c356a3 100644 --- a/smack-legacy/src/main/java/org/jivesoftware/smackx/xroster/packet/RosterExchange.java +++ b/smack-legacy/src/main/java/org/jivesoftware/smackx/xroster/packet/RosterExchange.java @@ -167,7 +167,7 @@ public class RosterExchange implements ExtensionElement { * */ @Override - public String toXML(String enclosingNamespace) { + public String toXML(org.jivesoftware.smack.packet.XmlEnvironment enclosingNamespace) { StringBuilder buf = new StringBuilder(); buf.append('<').append(getElementName()).append(" xmlns=\"").append(getNamespace()).append( "\">"); diff --git a/smack-omemo/src/main/java/org/jivesoftware/smackx/omemo/element/OmemoBundleElement.java b/smack-omemo/src/main/java/org/jivesoftware/smackx/omemo/element/OmemoBundleElement.java index bbd4392e2..efe872ec3 100644 --- a/smack-omemo/src/main/java/org/jivesoftware/smackx/omemo/element/OmemoBundleElement.java +++ b/smack-omemo/src/main/java/org/jivesoftware/smackx/omemo/element/OmemoBundleElement.java @@ -186,7 +186,7 @@ public abstract class OmemoBundleElement implements ExtensionElement { } @Override - public XmlStringBuilder toXML(String enclosingNamespace) { + public XmlStringBuilder toXML(org.jivesoftware.smack.packet.XmlEnvironment enclosingNamespace) { XmlStringBuilder sb = new XmlStringBuilder(this, enclosingNamespace).rightAngleBracket(); sb.halfOpenElement(SIGNED_PRE_KEY_PUB).attribute(SIGNED_PRE_KEY_ID, signedPreKeyId).rightAngleBracket() @@ -227,11 +227,11 @@ public abstract class OmemoBundleElement implements ExtensionElement { } OmemoBundleElement otherOmemoBundleElement = (OmemoBundleElement) other; - return toXML(null).equals(otherOmemoBundleElement.toXML(null)); + return toXML().toString().equals(otherOmemoBundleElement.toXML().toString()); } @Override public int hashCode() { - return this.toXML(null).hashCode(); + return toXML().toString().hashCode(); } } diff --git a/smack-omemo/src/main/java/org/jivesoftware/smackx/omemo/element/OmemoDeviceListElement.java b/smack-omemo/src/main/java/org/jivesoftware/smackx/omemo/element/OmemoDeviceListElement.java index 707d1cff6..34e222bbc 100644 --- a/smack-omemo/src/main/java/org/jivesoftware/smackx/omemo/element/OmemoDeviceListElement.java +++ b/smack-omemo/src/main/java/org/jivesoftware/smackx/omemo/element/OmemoDeviceListElement.java @@ -64,7 +64,7 @@ public abstract class OmemoDeviceListElement implements ExtensionElement { } @Override - public final XmlStringBuilder toXML(String enclosingNamespace) { + public final XmlStringBuilder toXML(org.jivesoftware.smack.packet.XmlEnvironment enclosingNamespace) { XmlStringBuilder sb = new XmlStringBuilder(this).rightAngleBracket(); for (Integer id : deviceIds) { diff --git a/smack-omemo/src/main/java/org/jivesoftware/smackx/omemo/element/OmemoElement.java b/smack-omemo/src/main/java/org/jivesoftware/smackx/omemo/element/OmemoElement.java index 27db720b9..d84852a72 100644 --- a/smack-omemo/src/main/java/org/jivesoftware/smackx/omemo/element/OmemoElement.java +++ b/smack-omemo/src/main/java/org/jivesoftware/smackx/omemo/element/OmemoElement.java @@ -73,7 +73,7 @@ public abstract class OmemoElement implements ExtensionElement { } @Override - public XmlStringBuilder toXML(String enclosingNamespace) { + public XmlStringBuilder toXML(org.jivesoftware.smack.packet.XmlEnvironment enclosingNamespace) { XmlStringBuilder sb = new XmlStringBuilder(this, enclosingNamespace).rightAngleBracket(); sb.element(header); diff --git a/smack-omemo/src/main/java/org/jivesoftware/smackx/omemo/element/OmemoHeaderElement.java b/smack-omemo/src/main/java/org/jivesoftware/smackx/omemo/element/OmemoHeaderElement.java index bafe4d2e4..8e8a07c09 100644 --- a/smack-omemo/src/main/java/org/jivesoftware/smackx/omemo/element/OmemoHeaderElement.java +++ b/smack-omemo/src/main/java/org/jivesoftware/smackx/omemo/element/OmemoHeaderElement.java @@ -66,7 +66,7 @@ public abstract class OmemoHeaderElement implements NamedElement { } @Override - public CharSequence toXML(String enclosingNamespace) { + public CharSequence toXML(org.jivesoftware.smack.packet.XmlEnvironment enclosingNamespace) { XmlStringBuilder sb = new XmlStringBuilder(this); sb.attribute(ATTR_SID, getSid()).rightAngleBracket(); diff --git a/smack-omemo/src/main/java/org/jivesoftware/smackx/omemo/element/OmemoKeyElement.java b/smack-omemo/src/main/java/org/jivesoftware/smackx/omemo/element/OmemoKeyElement.java index 6c2652495..75c0327d8 100644 --- a/smack-omemo/src/main/java/org/jivesoftware/smackx/omemo/element/OmemoKeyElement.java +++ b/smack-omemo/src/main/java/org/jivesoftware/smackx/omemo/element/OmemoKeyElement.java @@ -68,7 +68,7 @@ public class OmemoKeyElement implements NamedElement { } @Override - public CharSequence toXML(String enclosingNamespace) { + public CharSequence toXML(org.jivesoftware.smack.packet.XmlEnvironment enclosingNamespace) { XmlStringBuilder sb = new XmlStringBuilder(this); if (isPreKey()) { diff --git a/smack-omemo/src/test/java/org/jivesoftware/smackx/omemo/OmemoBundleVAxolotlElementTest.java b/smack-omemo/src/test/java/org/jivesoftware/smackx/omemo/OmemoBundleVAxolotlElementTest.java index 4054c891f..c19f5dd44 100644 --- a/smack-omemo/src/test/java/org/jivesoftware/smackx/omemo/OmemoBundleVAxolotlElementTest.java +++ b/smack-omemo/src/test/java/org/jivesoftware/smackx/omemo/OmemoBundleVAxolotlElementTest.java @@ -76,7 +76,7 @@ public class OmemoBundleVAxolotlElementTest extends SmackTestSuite { "" + "" + ""; - String actual = bundle.toXML(null).toString(); + String actual = bundle.toXML().toString(); assertEquals("Bundles XML must match.", expected, actual); byte[] signedPreKey = "SignedPreKey".getBytes(StringUtils.UTF8); diff --git a/smack-omemo/src/test/java/org/jivesoftware/smackx/omemo/OmemoDeviceListVAxolotlElementTest.java b/smack-omemo/src/test/java/org/jivesoftware/smackx/omemo/OmemoDeviceListVAxolotlElementTest.java index 7976d5996..946da1d1e 100644 --- a/smack-omemo/src/test/java/org/jivesoftware/smackx/omemo/OmemoDeviceListVAxolotlElementTest.java +++ b/smack-omemo/src/test/java/org/jivesoftware/smackx/omemo/OmemoDeviceListVAxolotlElementTest.java @@ -42,7 +42,7 @@ public class OmemoDeviceListVAxolotlElementTest extends SmackTestSuite { ids.add(9876); OmemoDeviceListElement_VAxolotl element = new OmemoDeviceListElement_VAxolotl(ids); - String xml = element.toXML(null).toString(); + String xml = element.toXML().toString(); XmlPullParser parser = TestUtils.getParser(xml); OmemoDeviceListElement_VAxolotl parsed = new OmemoDeviceListVAxolotlProvider().parse(parser); diff --git a/smack-omemo/src/test/java/org/jivesoftware/smackx/omemo/OmemoVAxolotlElementTest.java b/smack-omemo/src/test/java/org/jivesoftware/smackx/omemo/OmemoVAxolotlElementTest.java index 94d4aa1fa..c434b679e 100644 --- a/smack-omemo/src/test/java/org/jivesoftware/smackx/omemo/OmemoVAxolotlElementTest.java +++ b/smack-omemo/src/test/java/org/jivesoftware/smackx/omemo/OmemoVAxolotlElementTest.java @@ -66,12 +66,12 @@ public class OmemoVAxolotlElementTest extends SmackTestSuite { "" + ""; - String actual = element.toXML(null).toString(); + String actual = element.toXML().toString(); assertEquals("Serialized xml of OmemoElement must match.", expected, actual); OmemoElement_VAxolotl parsed = new OmemoVAxolotlProvider().parse(TestUtils.getParser(actual)); assertEquals("Parsed OmemoElement must equal the original.", - element.toXML(null).toString(), - parsed.toXML(null).toString()); + element.toXML().toString(), + parsed.toXML().toString()); } } diff --git a/smack-openpgp/src/main/java/org/jivesoftware/smackx/ox/element/CryptElement.java b/smack-openpgp/src/main/java/org/jivesoftware/smackx/ox/element/CryptElement.java index 4fbea2818..1189d1607 100644 --- a/smack-openpgp/src/main/java/org/jivesoftware/smackx/ox/element/CryptElement.java +++ b/smack-openpgp/src/main/java/org/jivesoftware/smackx/ox/element/CryptElement.java @@ -46,7 +46,7 @@ public class CryptElement extends EncryptedOpenPgpContentElement { } @Override - public XmlStringBuilder toXML(String enclosingNamespace) { + public XmlStringBuilder toXML(org.jivesoftware.smack.packet.XmlEnvironment enclosingNamespace) { XmlStringBuilder xml = new XmlStringBuilder(this).rightAngleBracket(); addCommonXml(xml); xml.closeElement(this); diff --git a/smack-openpgp/src/main/java/org/jivesoftware/smackx/ox/element/OpenPgpContentElement.java b/smack-openpgp/src/main/java/org/jivesoftware/smackx/ox/element/OpenPgpContentElement.java index 19c353c7e..2b61db669 100644 --- a/smack-openpgp/src/main/java/org/jivesoftware/smackx/ox/element/OpenPgpContentElement.java +++ b/smack-openpgp/src/main/java/org/jivesoftware/smackx/ox/element/OpenPgpContentElement.java @@ -183,7 +183,7 @@ public abstract class OpenPgpContentElement implements ExtensionElement { * @return InputStream over xml. */ public InputStream toInputStream() { - byte[] encoded = toXML(null).toString().getBytes(Charset.forName("UTF-8")); + byte[] encoded = toXML().toString().getBytes(Charset.forName("UTF-8")); return new ByteArrayInputStream(encoded); } } diff --git a/smack-openpgp/src/main/java/org/jivesoftware/smackx/ox/element/OpenPgpElement.java b/smack-openpgp/src/main/java/org/jivesoftware/smackx/ox/element/OpenPgpElement.java index c1eeb0894..f661ed7bf 100644 --- a/smack-openpgp/src/main/java/org/jivesoftware/smackx/ox/element/OpenPgpElement.java +++ b/smack-openpgp/src/main/java/org/jivesoftware/smackx/ox/element/OpenPgpElement.java @@ -70,7 +70,7 @@ public class OpenPgpElement implements ExtensionElement { } @Override - public XmlStringBuilder toXML(String enclosingNamespace) { + public XmlStringBuilder toXML(org.jivesoftware.smack.packet.XmlEnvironment enclosingNamespace) { XmlStringBuilder xml = new XmlStringBuilder(this); xml.rightAngleBracket().append(base64EncodedOpenPgpMessage).closeElement(this); return xml; diff --git a/smack-openpgp/src/main/java/org/jivesoftware/smackx/ox/element/PubkeyElement.java b/smack-openpgp/src/main/java/org/jivesoftware/smackx/ox/element/PubkeyElement.java index 099ae9df9..d08d65079 100644 --- a/smack-openpgp/src/main/java/org/jivesoftware/smackx/ox/element/PubkeyElement.java +++ b/smack-openpgp/src/main/java/org/jivesoftware/smackx/ox/element/PubkeyElement.java @@ -73,7 +73,7 @@ public class PubkeyElement implements ExtensionElement { } @Override - public XmlStringBuilder toXML(String enclosingNamespace) { + public XmlStringBuilder toXML(org.jivesoftware.smack.packet.XmlEnvironment enclosingNamespace) { XmlStringBuilder xml = new XmlStringBuilder(this) .optAttribute(ATTR_DATE, date) .rightAngleBracket() @@ -110,7 +110,7 @@ public class PubkeyElement implements ExtensionElement { } @Override - public XmlStringBuilder toXML(String enclosingNamespace) { + public XmlStringBuilder toXML(org.jivesoftware.smack.packet.XmlEnvironment enclosingNamespace) { XmlStringBuilder xml = new XmlStringBuilder(this) .rightAngleBracket() .append(new String(b64Data, Charset.forName("UTF-8"))) diff --git a/smack-openpgp/src/main/java/org/jivesoftware/smackx/ox/element/PublicKeysListElement.java b/smack-openpgp/src/main/java/org/jivesoftware/smackx/ox/element/PublicKeysListElement.java index 16536dc2c..6405ecd6a 100644 --- a/smack-openpgp/src/main/java/org/jivesoftware/smackx/ox/element/PublicKeysListElement.java +++ b/smack-openpgp/src/main/java/org/jivesoftware/smackx/ox/element/PublicKeysListElement.java @@ -64,7 +64,7 @@ public final class PublicKeysListElement implements ExtensionElement { } @Override - public XmlStringBuilder toXML(String enclosingNamespace) { + public XmlStringBuilder toXML(org.jivesoftware.smack.packet.XmlEnvironment enclosingNamespace) { XmlStringBuilder xml = new XmlStringBuilder(this).rightAngleBracket(); for (PubkeyMetadataElement metadataElement : metadata.values()) { xml.element(metadataElement); @@ -124,7 +124,7 @@ public final class PublicKeysListElement implements ExtensionElement { } @Override - public XmlStringBuilder toXML(String enclosingNamespace) { + public XmlStringBuilder toXML(org.jivesoftware.smack.packet.XmlEnvironment enclosingNamespace) { XmlStringBuilder xml = new XmlStringBuilder(this) .attribute(ATTR_V4_FINGERPRINT, getV4Fingerprint()) .attribute(ATTR_DATE, date).closeEmptyElement(); diff --git a/smack-openpgp/src/main/java/org/jivesoftware/smackx/ox/element/SecretkeyElement.java b/smack-openpgp/src/main/java/org/jivesoftware/smackx/ox/element/SecretkeyElement.java index f9da93234..6476d506d 100644 --- a/smack-openpgp/src/main/java/org/jivesoftware/smackx/ox/element/SecretkeyElement.java +++ b/smack-openpgp/src/main/java/org/jivesoftware/smackx/ox/element/SecretkeyElement.java @@ -54,7 +54,7 @@ public class SecretkeyElement implements ExtensionElement { } @Override - public XmlStringBuilder toXML(String enclosingNamespace) { + public XmlStringBuilder toXML(org.jivesoftware.smack.packet.XmlEnvironment enclosingNamespace) { XmlStringBuilder xml = new XmlStringBuilder(this) .rightAngleBracket() .append(new String(b64Data, Charset.forName("UTF-8"))) diff --git a/smack-openpgp/src/main/java/org/jivesoftware/smackx/ox/element/SignElement.java b/smack-openpgp/src/main/java/org/jivesoftware/smackx/ox/element/SignElement.java index df751839f..abf7829eb 100644 --- a/smack-openpgp/src/main/java/org/jivesoftware/smackx/ox/element/SignElement.java +++ b/smack-openpgp/src/main/java/org/jivesoftware/smackx/ox/element/SignElement.java @@ -45,7 +45,7 @@ public class SignElement extends OpenPgpContentElement { } @Override - public XmlStringBuilder toXML(String enclosingNamespace) { + public XmlStringBuilder toXML(org.jivesoftware.smack.packet.XmlEnvironment enclosingNamespace) { XmlStringBuilder xml = new XmlStringBuilder(this).rightAngleBracket(); addCommonXml(xml); xml.closeElement(this); diff --git a/smack-openpgp/src/main/java/org/jivesoftware/smackx/ox/element/SigncryptElement.java b/smack-openpgp/src/main/java/org/jivesoftware/smackx/ox/element/SigncryptElement.java index f97aba5ee..d0d165a86 100644 --- a/smack-openpgp/src/main/java/org/jivesoftware/smackx/ox/element/SigncryptElement.java +++ b/smack-openpgp/src/main/java/org/jivesoftware/smackx/ox/element/SigncryptElement.java @@ -49,7 +49,7 @@ public class SigncryptElement extends EncryptedOpenPgpContentElement { } @Override - public XmlStringBuilder toXML(String enclosingNamespace) { + public XmlStringBuilder toXML(org.jivesoftware.smack.packet.XmlEnvironment enclosingNamespace) { XmlStringBuilder xml = new XmlStringBuilder(this).rightAngleBracket(); addCommonXml(xml); xml.closeElement(this); diff --git a/smack-openpgp/src/test/java/org/jivesoftware/smackx/ox/OpenPgpElementTest.java b/smack-openpgp/src/test/java/org/jivesoftware/smackx/ox/OpenPgpElementTest.java index 28724bcb8..2db1c50de 100644 --- a/smack-openpgp/src/test/java/org/jivesoftware/smackx/ox/OpenPgpElementTest.java +++ b/smack-openpgp/src/test/java/org/jivesoftware/smackx/ox/OpenPgpElementTest.java @@ -70,7 +70,7 @@ public class OpenPgpElementTest extends SmackTestSuite { OpenPgpElement element = new OpenPgpElement("BASE64_OPENPGP_MESSAGE"); - assertXMLEqual(expected, element.toXML(null).toString()); + assertXMLEqual(expected, element.toXML().toString()); XmlPullParser parser = TestUtils.getParser(expected); OpenPgpElement parsed = OpenPgpElementProvider.TEST_INSTANCE.parse(parser); @@ -102,7 +102,7 @@ public class OpenPgpElementTest extends SmackTestSuite { payload.add(new Message.Body("en", "Hello World!")); SignElement element = new SignElement(recipients, testDate, payload); - assertXMLEqual(expected, element.toXML(null).toString()); + assertXMLEqual(expected, element.toXML().toString()); XmlPullParser parser = TestUtils.getParser(expected); SignElement parsed = (SignElement) OpenPgpContentElementProvider.parseOpenPgpContentElement(parser); @@ -132,7 +132,7 @@ public class OpenPgpElementTest extends SmackTestSuite { testDate, payload); - assertXMLEqual(expected, element.toXML(null).toString()); + assertXMLEqual(expected, element.toXML().toString()); XmlPullParser parser = TestUtils.getParser(expected); CryptElement parsed = (CryptElement) OpenPgpContentElementProvider.parseOpenPgpContentElement(parser); @@ -162,7 +162,7 @@ public class OpenPgpElementTest extends SmackTestSuite { "f0rm1l4n4-mT8y33j!Y%fRSrcd^ZE4Q7VDt1L%WEgR!kv", testDate, payload); - assertXMLEqual(expected, element.toXML(null).toString()); + assertXMLEqual(expected, element.toXML().toString()); XmlPullParser parser = TestUtils.getParser(expected); SigncryptElement parsed = (SigncryptElement) OpenPgpContentElementProvider.parseOpenPgpContentElement(parser); diff --git a/smack-openpgp/src/test/java/org/jivesoftware/smackx/ox/PubkeyElementTest.java b/smack-openpgp/src/test/java/org/jivesoftware/smackx/ox/PubkeyElementTest.java index 8553ce5bf..1d1bb6837 100644 --- a/smack-openpgp/src/test/java/org/jivesoftware/smackx/ox/PubkeyElementTest.java +++ b/smack-openpgp/src/test/java/org/jivesoftware/smackx/ox/PubkeyElementTest.java @@ -48,7 +48,7 @@ public class PubkeyElementTest extends SmackTestSuite { byte[] key = "BASE64_OPENPGP_PUBLIC_KEY".getBytes(Charset.forName("UTF-8")); PubkeyElement element = new PubkeyElement(new PubkeyElement.PubkeyDataElement(key), date); - assertXMLEqual(expected, element.toXML(null).toString()); + assertXMLEqual(expected, element.toXML().toString()); XmlPullParser parser = TestUtils.getParser(expected); PubkeyElement parsed = PubkeyElementProvider.TEST_INSTANCE.parse(parser); diff --git a/smack-openpgp/src/test/java/org/jivesoftware/smackx/ox/PublicKeysListElementTest.java b/smack-openpgp/src/test/java/org/jivesoftware/smackx/ox/PublicKeysListElementTest.java index f8928edd8..fc5364071 100644 --- a/smack-openpgp/src/test/java/org/jivesoftware/smackx/ox/PublicKeysListElementTest.java +++ b/smack-openpgp/src/test/java/org/jivesoftware/smackx/ox/PublicKeysListElementTest.java @@ -62,7 +62,7 @@ public class PublicKeysListElementTest extends SmackTestSuite { .addMetadata(child2) .build(); - assertXMLEqual(expected, element.toXML(null).toString()); + assertXMLEqual(expected, element.toXML().toString()); XmlPullParser parser = TestUtils.getParser(expected); PublicKeysListElement parsed = PublicKeysListElementProvider.TEST_INSTANCE.parse(parser); diff --git a/smack-openpgp/src/test/java/org/jivesoftware/smackx/ox/SecretkeyElementTest.java b/smack-openpgp/src/test/java/org/jivesoftware/smackx/ox/SecretkeyElementTest.java index 4e802aebc..5eddd9109 100644 --- a/smack-openpgp/src/test/java/org/jivesoftware/smackx/ox/SecretkeyElementTest.java +++ b/smack-openpgp/src/test/java/org/jivesoftware/smackx/ox/SecretkeyElementTest.java @@ -42,7 +42,7 @@ public class SecretkeyElementTest extends SmackTestSuite { SecretkeyElement element = new SecretkeyElement(key); - assertXMLEqual(expected, element.toXML(null).toString()); + assertXMLEqual(expected, element.toXML().toString()); XmlPullParser parser = TestUtils.getParser(expected); SecretkeyElement parsed = SecretkeyElementProvider.TEST_INSTANCE.parse(parser); diff --git a/smack-repl/src/main/java/org/igniterealtime/smack/smackrepl/IoT.java b/smack-repl/src/main/java/org/igniterealtime/smack/smackrepl/IoT.java index cb5601da2..163ca53b6 100644 --- a/smack-repl/src/main/java/org/igniterealtime/smack/smackrepl/IoT.java +++ b/smack-repl/src/main/java/org/igniterealtime/smack/smackrepl/IoT.java @@ -126,7 +126,7 @@ public class IoT { throw new IllegalStateException("Unexpected number of values returned: " + values.size()); } IoTFieldsExtension field = values.get(0); - printStatus("DATA READ-OUT SUCCESS: " + field.toXML(null)); + printStatus("DATA READ-OUT SUCCESS: " + field.toXML()); printStatus("IoT SCENARIO FINISHED SUCCESSFULLY"); } }; diff --git a/smack-tcp/src/main/java/org/jivesoftware/smack/sm/packet/StreamManagement.java b/smack-tcp/src/main/java/org/jivesoftware/smack/sm/packet/StreamManagement.java index 201f760e0..aa3840c42 100644 --- a/smack-tcp/src/main/java/org/jivesoftware/smack/sm/packet/StreamManagement.java +++ b/smack-tcp/src/main/java/org/jivesoftware/smack/sm/packet/StreamManagement.java @@ -47,7 +47,7 @@ public class StreamManagement { } @Override - public CharSequence toXML(String enclosingNamespace) { + public CharSequence toXML(org.jivesoftware.smack.packet.XmlEnvironment enclosingNamespace) { XmlStringBuilder xml = new XmlStringBuilder(this, enclosingNamespace); xml.closeEmptyElement(); return xml; @@ -113,7 +113,7 @@ public class StreamManagement { } @Override - public CharSequence toXML(String enclosingNamespace) { + public CharSequence toXML(org.jivesoftware.smack.packet.XmlEnvironment enclosingNamespace) { XmlStringBuilder xml = new XmlStringBuilder(this, enclosingNamespace); maybeAddResumeAttributeTo(xml); maybeAddMaxAttributeTo(xml); @@ -174,7 +174,7 @@ public class StreamManagement { } @Override - public CharSequence toXML(String enclosingNamespace) { + public CharSequence toXML(org.jivesoftware.smack.packet.XmlEnvironment enclosingNamespace) { XmlStringBuilder xml = new XmlStringBuilder(this, enclosingNamespace); xml.optAttribute("id", id); maybeAddResumeAttributeTo(xml); @@ -220,7 +220,7 @@ public class StreamManagement { } @Override - public CharSequence toXML(String enclosingNamespace) { + public CharSequence toXML(org.jivesoftware.smack.packet.XmlEnvironment enclosingNamespace) { XmlStringBuilder xml = new XmlStringBuilder(this, enclosingNamespace); if (condition == null && textElements.isEmpty()) { xml.closeEmptyElement(); @@ -273,7 +273,7 @@ public class StreamManagement { } @Override - public final XmlStringBuilder toXML(String enclosingNamespace) { + public final XmlStringBuilder toXML(org.jivesoftware.smack.packet.XmlEnvironment enclosingNamespace) { XmlStringBuilder xml = new XmlStringBuilder(this, enclosingNamespace); xml.attribute("h", Long.toString(handledCount)); xml.attribute("previd", previd); @@ -322,7 +322,7 @@ public class StreamManagement { } @Override - public CharSequence toXML(String enclosingNamespace) { + public CharSequence toXML(org.jivesoftware.smack.packet.XmlEnvironment enclosingNamespace) { XmlStringBuilder xml = new XmlStringBuilder(this, enclosingNamespace); xml.attribute("h", Long.toString(handledCount)); xml.closeEmptyElement(); @@ -348,7 +348,7 @@ public class StreamManagement { } @Override - public CharSequence toXML(String enclosingNamespace) { + public CharSequence toXML(org.jivesoftware.smack.packet.XmlEnvironment enclosingNamespace) { return '<' + ELEMENT + " xmlns='" + NAMESPACE + "'/>"; } diff --git a/smack-tcp/src/main/java/org/jivesoftware/smack/tcp/XMPPTCPConnection.java b/smack-tcp/src/main/java/org/jivesoftware/smack/tcp/XMPPTCPConnection.java index dc866897f..f8d81dd0b 100644 --- a/smack-tcp/src/main/java/org/jivesoftware/smack/tcp/XMPPTCPConnection.java +++ b/smack-tcp/src/main/java/org/jivesoftware/smack/tcp/XMPPTCPConnection.java @@ -1292,7 +1292,7 @@ public class XMPPTCPConnection extends AbstractXMPPConnection { Stanza stanza = (Stanza) packet; maybeAddToUnacknowledgedStanzas(stanza); } - writer.write(packet.toXML(null).toString()); + writer.write(packet.toXML().toString()); } writer.flush(); } @@ -1369,7 +1369,7 @@ public class XMPPTCPConnection extends AbstractXMPPConnection { // If the unacknowledgedStanza queue is nearly full, request an new ack // from the server in order to drain it if (unacknowledgedStanzas.size() == 0.8 * XMPPTCPConnection.QUEUE_SIZE) { - writer.write(AckRequest.INSTANCE.toXML(null).toString()); + writer.write(AckRequest.INSTANCE.toXML().toString()); writer.flush(); } try { diff --git a/smack-tcp/src/test/java/org/jivesoftware/smack/sm/provider/ParseStreamManagementTest.java b/smack-tcp/src/test/java/org/jivesoftware/smack/sm/provider/ParseStreamManagementTest.java index 4d62390a2..59dcd0203 100644 --- a/smack-tcp/src/test/java/org/jivesoftware/smack/sm/provider/ParseStreamManagementTest.java +++ b/smack-tcp/src/test/java/org/jivesoftware/smack/sm/provider/ParseStreamManagementTest.java @@ -68,11 +68,11 @@ public class ParseStreamManagementTest { @Test public void testParseEnabledInvariant() throws XmlPullParserException, IOException { - String enabledString = new StreamManagement.Enabled("stream-id", false).toXML(null).toString(); + String enabledString = new StreamManagement.Enabled("stream-id", false).toXML().toString(); XmlPullParser parser = PacketParserUtils.getParserFor(enabledString); StreamManagement.Enabled enabled = ParseStreamManagement.enabled(parser); - assertEquals(enabledString, enabled.toXML(null).toString()); + assertEquals(enabledString, enabled.toXML().toString()); } @Test