From e0e4fd9b12dd3f8402e047b53de68b5fa9f1902a Mon Sep 17 00:00:00 2001 From: Florian Schmaus Date: Tue, 21 Jul 2015 08:19:15 +0200 Subject: [PATCH] Add checkstyle rule for StringBuilder.append(char) And replace all instances where String.Builder.append() is called with a String of length one with append(char). Also adds StringUtils.toStringBuilder(Collection, String). --- config/checkstyle.xml | 12 +++++++ .../org/jivesoftware/smack/MessageTest.java | 2 +- .../smack/filter/AbstractListFilter.java | 12 ++----- .../jivesoftware/smack/util/StringUtils.java | 23 +++++++++---- .../address/packet/MultipleAddresses.java | 2 +- .../smackx/amp/packet/AMPExtension.java | 12 +++---- .../attention/packet/AttentionExtension.java | 2 +- .../smackx/caps/EntityCapsManager.java | 14 ++++---- .../commands/packet/AdHocCommandData.java | 2 +- .../iqprivate/packet/DefaultPrivateData.java | 8 ++--- .../jivesoftware/smackx/nick/packet/Nick.java | 2 +- .../offline/packet/OfflineMessageInfo.java | 4 +-- .../offline/packet/OfflineMessageRequest.java | 6 ++-- .../smackx/pep/packet/PEPEvent.java | 4 +-- .../smackx/pep/packet/PEPItem.java | 4 +-- .../smackx/privacy/packet/PrivacyItem.java | 8 ++--- .../org/jivesoftware/smackx/pubsub/Item.java | 4 +-- .../smackx/pubsub/ItemsExtension.java | 2 +- .../smackx/pubsub/PayloadItem.java | 6 ++-- .../smackx/pubsub/SubscribeExtension.java | 2 +- .../smackx/pubsub/Subscription.java | 4 +-- .../smackx/pubsub/SubscriptionsExtension.java | 6 ++-- .../smackx/search/SimpleUserSearch.java | 2 +- .../smackx/si/packet/StreamInitiation.java | 6 ++-- .../org/jivesoftware/smackx/xdata/Form.java | 2 +- .../smack/roster/RosterEntry.java | 2 +- .../smack/java7/XmppHostnameVerifier.java | 4 +-- .../smackx/jingleold/media/PayloadType.java | 8 ++--- .../smackx/jingleold/nat/RTPBridge.java | 12 +++---- .../smackx/jingleold/packet/Jingle.java | 10 +++--- .../jingleold/packet/JingleContent.java | 4 +-- .../packet/JingleContentDescription.java | 12 +++---- .../jingleold/packet/JingleContentInfo.java | 2 +- .../jingleold/packet/JingleDescription.java | 4 +-- .../smackx/jingleold/packet/JingleError.java | 2 +- .../jingleold/packet/JingleTransport.java | 34 +++++++++---------- .../smackx/workgroup/packet/AgentStatus.java | 18 +++++----- .../smackx/workgroup/packet/QueueDetails.java | 4 +-- .../workgroup/packet/QueueOverview.java | 4 +-- .../smackx/workgroup/packet/SessionID.java | 2 +- .../smackx/workgroup/packet/UserID.java | 2 +- .../packet/WorkgroupInformation.java | 2 +- .../workgroup/settings/GenericSettings.java | 2 +- .../smackx/xevent/packet/MessageEvent.java | 12 +++---- .../smackx/xroster/RemoteRosterEntry.java | 6 ++-- .../smackx/xroster/packet/RosterExchange.java | 4 +-- 46 files changed, 159 insertions(+), 142 deletions(-) diff --git a/config/checkstyle.xml b/config/checkstyle.xml index 4dc35f6b6..b83128a03 100644 --- a/config/checkstyle.xml +++ b/config/checkstyle.xml @@ -19,6 +19,18 @@ + + + + + diff --git a/smack-core/src/integration-test/java/org/jivesoftware/smack/MessageTest.java b/smack-core/src/integration-test/java/org/jivesoftware/smack/MessageTest.java index 299e0b7df..bb03e58d4 100644 --- a/smack-core/src/integration-test/java/org/jivesoftware/smack/MessageTest.java +++ b/smack-core/src/integration-test/java/org/jivesoftware/smack/MessageTest.java @@ -160,7 +160,7 @@ public class MessageTest extends SmackTestCase { Message msg = new Message(getFullJID(1), Message.Type.chat); StringBuilder sb = new StringBuilder(5000); for (int i = 0; i <= 4000; i++) { - sb.append("X"); + sb.append('X'); } msg.setBody(sb.toString()); diff --git a/smack-core/src/main/java/org/jivesoftware/smack/filter/AbstractListFilter.java b/smack-core/src/main/java/org/jivesoftware/smack/filter/AbstractListFilter.java index 0b5f47ba8..708d7b52f 100644 --- a/smack-core/src/main/java/org/jivesoftware/smack/filter/AbstractListFilter.java +++ b/smack-core/src/main/java/org/jivesoftware/smack/filter/AbstractListFilter.java @@ -19,10 +19,10 @@ package org.jivesoftware.smack.filter; import java.util.ArrayList; import java.util.Arrays; -import java.util.Iterator; import java.util.List; import org.jivesoftware.smack.util.Objects; +import org.jivesoftware.smack.util.StringUtils; public abstract class AbstractListFilter implements StanzaFilter { @@ -67,14 +67,8 @@ public abstract class AbstractListFilter implements StanzaFilter { StringBuilder sb = new StringBuilder(); sb.append(getClass().getSimpleName()); sb.append(": ("); - for (Iterator it = filters.iterator(); it.hasNext();) { - StanzaFilter filter = it.next(); - sb.append(filter.toString()); - if (it.hasNext()) { - sb.append(", "); - } - } - sb.append(")"); + sb.append(StringUtils.toStringBuilder(filters, ", ")); + sb.append(')'); return sb.toString(); } } diff --git a/smack-core/src/main/java/org/jivesoftware/smack/util/StringUtils.java b/smack-core/src/main/java/org/jivesoftware/smack/util/StringUtils.java index becc6ce19..0de4e93e3 100644 --- a/smack-core/src/main/java/org/jivesoftware/smack/util/StringUtils.java +++ b/smack-core/src/main/java/org/jivesoftware/smack/util/StringUtils.java @@ -222,21 +222,32 @@ public class StringUtils { } /** - * Transform a collection of CharSequences to a whitespace delimited String. + * Transform a collection of objects to a whitespace delimited String. * * @param collection the collection to transform. * @return a String with all the elements of the collection. */ - public static String collectionToString(Collection collection) { + public static String collectionToString(Collection collection) { + return toStringBuilder(collection, " ").toString(); + } + + /** + * Transform a collection of objects to a delimited String. + * + * @param collection the collection to transform. + * @param delimiter the delimiter used to delimit the Strings. + * @return a StringBuilder with all the elements of the collection. + */ + public static StringBuilder toStringBuilder(Collection collection, String delimiter) { StringBuilder sb = new StringBuilder(collection.size() * 20); - for (Iterator it = collection.iterator(); it.hasNext();) { - CharSequence cs = it.next(); + for (Iterator it = collection.iterator(); it.hasNext();) { + Object cs = it.next(); sb.append(cs); if (it.hasNext()) { - sb.append(' '); + sb.append(delimiter); } } - return sb.toString(); + return sb; } public static String returnIfNotEmptyTrimmed(String string) { 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 14777bf0e..2eac46e0f 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 @@ -201,7 +201,7 @@ public class MultipleAddresses implements ExtensionElement { buf.optAttribute("desc", description); if (description != null && description.trim().length() > 0) { buf.append(" desc=\""); - buf.append(description).append("\""); + buf.append(description).append('"'); } buf.optBooleanAttribute("delivered", delivered); buf.optAttribute("uri", uri); 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 efcd21532..492c3b7ed 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 @@ -155,27 +155,27 @@ public class AMPExtension implements ExtensionElement { @Override public String toXML() { StringBuilder buf = new StringBuilder(); - buf.append("<").append(getElementName()).append(" xmlns=\"").append(getNamespace()).append("\""); + buf.append('<').append(getElementName()).append(" xmlns=\"").append(getNamespace()).append('"'); if (status != null) { - buf.append(" status=\"").append(status.toString()).append("\""); + buf.append(" status=\"").append(status.toString()).append('"'); } if (to != null) { - buf.append(" to=\"").append(to).append("\""); + buf.append(" to=\"").append(to).append('"'); } if (from != null) { - buf.append(" from=\"").append(from).append("\""); + buf.append(" from=\"").append(from).append('"'); } if (perHop) { buf.append(" per-hop=\"true\""); } - buf.append(">"); + buf.append('>'); // Loop through all the rules and append them to the string buffer for (Rule rule : getRules()) { buf.append(rule.toXML()); } - buf.append(""); + buf.append("'); return buf.toString(); } 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 a812fdd26..8fe39bdc7 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 @@ -67,7 +67,7 @@ public class AttentionExtension implements ExtensionElement { */ public String toXML() { final StringBuilder sb = new StringBuilder(); - sb.append("<").append(getElementName()).append(" xmlns=\"").append( + sb.append('<').append(getElementName()).append(" xmlns=\"").append( getNamespace()).append("\"/>"); return sb.toString(); } diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/caps/EntityCapsManager.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/caps/EntityCapsManager.java index a8e581a22..81de76444 100644 --- a/smack-extensions/src/main/java/org/jivesoftware/smackx/caps/EntityCapsManager.java +++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/caps/EntityCapsManager.java @@ -631,13 +631,13 @@ public final class EntityCapsManager extends Manager { // followed by the '<' character. for (DiscoverInfo.Identity identity : sortedIdentities) { sb.append(identity.getCategory()); - sb.append("/"); + sb.append('/'); sb.append(identity.getType()); - sb.append("/"); + sb.append('/'); sb.append(identity.getLanguage() == null ? "" : identity.getLanguage()); - sb.append("/"); + sb.append('/'); sb.append(identity.getName() == null ? "" : identity.getName()); - sb.append("<"); + sb.append('<'); } // 4. Sort the supported service discovery features. @@ -649,7 +649,7 @@ public final class EntityCapsManager extends Manager { // character for (String f : features) { sb.append(f); - sb.append("<"); + sb.append('<'); } // only use the data form for calculation is it has a hidden FORM_TYPE @@ -690,7 +690,7 @@ public final class EntityCapsManager extends Manager { // followed by the '<' character. for (FormField f : fs) { sb.append(f.getVariable()); - sb.append("<"); + sb.append('<'); formFieldValuesToCaps(f.getValues(), sb); } } @@ -719,7 +719,7 @@ public final class EntityCapsManager extends Manager { } for (String fv : fvs) { sb.append(fv); - sb.append("<"); + sb.append('<'); } } 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 f842c76f5..56a107a03 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 @@ -261,7 +261,7 @@ public class AdHocCommandData extends IQ { public String toXML() { StringBuilder buf = new StringBuilder(); - buf.append("<").append(getElementName()); + buf.append('<').append(getElementName()); buf.append(" xmlns=\"").append(getNamespace()).append("\"/>"); return buf.toString(); } diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/iqprivate/packet/DefaultPrivateData.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/iqprivate/packet/DefaultPrivateData.java index b710db828..02a208452 100644 --- a/smack-extensions/src/main/java/org/jivesoftware/smackx/iqprivate/packet/DefaultPrivateData.java +++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/iqprivate/packet/DefaultPrivateData.java @@ -81,14 +81,14 @@ public class DefaultPrivateData implements PrivateData { public String toXML() { StringBuilder buf = new StringBuilder(); - buf.append("<").append(elementName).append(" xmlns=\"").append(namespace).append("\">"); + buf.append('<').append(elementName).append(" xmlns=\"").append(namespace).append("\">"); for (String name : getNames()) { String value = getValue(name); - buf.append("<").append(name).append(">"); + buf.append('<').append(name).append('>'); buf.append(value); - buf.append(""); + buf.append("'); } - buf.append(""); + buf.append("'); return buf.toString(); } 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 d8e21f26b..e6c194d50 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 @@ -86,7 +86,7 @@ public class Nick implements ExtensionElement { public String toXML() { final StringBuilder buf = new StringBuilder(); - buf.append("<").append(ELEMENT_NAME).append(" xmlns=\"").append( + buf.append('<').append(ELEMENT_NAME).append(" xmlns=\"").append( NAMESPACE).append("\">"); buf.append(getName()); buf.append("'); 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 9826b8ba2..237debfda 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 @@ -80,11 +80,11 @@ public class OfflineMessageInfo implements ExtensionElement { public String toXML() { StringBuilder buf = new StringBuilder(); - buf.append("<").append(getElementName()).append(" xmlns=\"").append(getNamespace()).append( + buf.append('<').append(getElementName()).append(" xmlns=\"").append(getNamespace()).append( "\">"); if (getNode() != null) buf.append(""); - buf.append(""); + buf.append("'); return buf.toString(); } diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/offline/packet/OfflineMessageRequest.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/offline/packet/OfflineMessageRequest.java index c66a42907..6aba162e4 100644 --- a/smack-extensions/src/main/java/org/jivesoftware/smackx/offline/packet/OfflineMessageRequest.java +++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/offline/packet/OfflineMessageRequest.java @@ -182,13 +182,13 @@ public class OfflineMessageRequest extends IQ { StringBuilder buf = new StringBuilder(); buf.append(""); return buf.toString(); diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/pep/packet/PEPEvent.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/pep/packet/PEPEvent.java index 44b493578..19819d0e1 100644 --- a/smack-extensions/src/main/java/org/jivesoftware/smackx/pep/packet/PEPEvent.java +++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/pep/packet/PEPEvent.java @@ -93,9 +93,9 @@ public class PEPEvent implements ExtensionElement { */ public String toXML() { StringBuilder buf = new StringBuilder(); - buf.append("<").append(getElementName()).append(" xmlns=\"").append(getNamespace()).append("\">"); + buf.append('<').append(getElementName()).append(" xmlns=\"").append(getNamespace()).append("\">"); buf.append(item.toXML()); - buf.append(""); + buf.append("'); return buf.toString(); } diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/pep/packet/PEPItem.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/pep/packet/PEPItem.java index b95442201..30a64d5f1 100644 --- a/smack-extensions/src/main/java/org/jivesoftware/smackx/pep/packet/PEPItem.java +++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/pep/packet/PEPItem.java @@ -80,9 +80,9 @@ public abstract class PEPItem implements ExtensionElement { */ public String toXML() { StringBuilder buf = new StringBuilder(); - buf.append("<").append(getElementName()).append(" id=\"").append(id).append("\">"); + buf.append('<').append(getElementName()).append(" id=\"").append(id).append("\">"); buf.append(getItemDetailsXML()); - buf.append(""); + buf.append("'); return buf.toString(); } diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/privacy/packet/PrivacyItem.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/privacy/packet/PrivacyItem.java index 4dee44fcb..10a6aa794 100644 --- a/smack-extensions/src/main/java/org/jivesoftware/smackx/privacy/packet/PrivacyItem.java +++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/privacy/packet/PrivacyItem.java @@ -296,17 +296,17 @@ public class PrivacyItem { } else { buf.append(" action=\"deny\""); } - buf.append(" order=\"").append(getOrder()).append("\""); + buf.append(" order=\"").append(getOrder()).append('"'); if (getType() != null) { - buf.append(" type=\"").append(getType()).append("\""); + buf.append(" type=\"").append(getType()).append('"'); } if (getValue() != null) { - buf.append(" value=\"").append(getValue()).append("\""); + buf.append(" value=\"").append(getValue()).append('"'); } if (isFilterEverything()) { buf.append("/>"); } else { - buf.append(">"); + buf.append('>'); if (this.isFilterIQ()) { buf.append(""); } 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 ae52eccbf..177f222d3 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 @@ -122,13 +122,13 @@ public class Item extends NodeExtension { builder.append(" id='"); builder.append(id); - builder.append("'"); + builder.append('\''); } if (getNode() != null) { builder.append(" node='"); builder.append(getNode()); - builder.append("'"); + builder.append('\''); } builder.append("/>"); 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 1c9f02947..a21f9065a 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 @@ -183,7 +183,7 @@ public class ItemsExtension extends NodeExtension implements EmbeddedPacketExten builder.append(""); + builder.append('>'); return builder.toString(); } } 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 50ee2b150..ec8112596 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 @@ -118,15 +118,15 @@ public class PayloadItem extends Item { builder.append(" id='"); builder.append(getId()); - builder.append("'"); + builder.append('\''); } if (getNode() != null) { builder.append(" node='"); builder.append(getNode()); - builder.append("'"); + builder.append('\''); } - builder.append(">"); + builder.append('>'); builder.append(payload.toXML()); builder.append(""); 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 c84a7a63e..08485ab7d 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 @@ -52,7 +52,7 @@ public class SubscribeExtension extends NodeExtension { builder.append(" node='"); builder.append(getNode()); - builder.append("'"); + builder.append('\''); } builder.append(" jid='"); builder.append(getJid()); 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 bbd16431f..4308639bc 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 @@ -153,11 +153,11 @@ public class Subscription extends NodeExtension private static void appendAttribute(StringBuilder builder, String att, String value) { - builder.append(" "); + builder.append(' '); builder.append(att); builder.append("='"); builder.append(value); - builder.append("'"); + builder.append('\''); } } 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 f28884469..dad68e891 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 @@ -81,9 +81,9 @@ public class SubscriptionsExtension extends NodeExtension { builder.append(" node='"); builder.append(getNode()); - builder.append("'"); + builder.append('\''); } - builder.append(">"); + builder.append('>'); for (Subscription item : items) { @@ -92,7 +92,7 @@ public class SubscriptionsExtension extends NodeExtension builder.append(""); + builder.append('>'); return builder.toString(); } } diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/search/SimpleUserSearch.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/search/SimpleUserSearch.java index be7e5aa7e..921da6eed 100644 --- a/smack-extensions/src/main/java/org/jivesoftware/smackx/search/SimpleUserSearch.java +++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/search/SimpleUserSearch.java @@ -75,7 +75,7 @@ class SimpleUserSearch extends IQ { String name = field.getVariable(); String value = getSingleValue(field); if (value.trim().length() > 0) { - buf.append("<").append(name).append(">").append(value).append(""); + buf.append('<').append(name).append('>').append(value).append("'); } } 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 2242a0673..ea077ebad 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 @@ -328,7 +328,7 @@ public class StreamInitiation extends IQ { public String toXML() { StringBuilder buffer = new StringBuilder(); - buffer.append("<").append(getElementName()).append(" xmlns=\"") + buffer.append('<').append(getElementName()).append(" xmlns=\"") .append(getNamespace()).append("\" "); if (getName() != null) { @@ -348,14 +348,14 @@ public class StreamInitiation extends IQ { } if ((desc != null && desc.length() > 0) || isRanged) { - buffer.append(">"); + buffer.append('>'); if (getDesc() != null && desc.length() > 0) { buffer.append("").append(StringUtils.escapeForXML(getDesc())).append(""); } if (isRanged()) { buffer.append(""); } - buffer.append(""); + buffer.append("'); } else { buffer.append("/>"); diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/xdata/Form.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/xdata/Form.java index 3f6d59a3c..fc67214a8 100644 --- a/smack-extensions/src/main/java/org/jivesoftware/smackx/xdata/Form.java +++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/xdata/Form.java @@ -376,7 +376,7 @@ public class Form { sb.append(it.next()); // If this is not the last instruction then append a newline if (it.hasNext()) { - sb.append("\n"); + sb.append('\n'); } } return sb.toString(); diff --git a/smack-im/src/main/java/org/jivesoftware/smack/roster/RosterEntry.java b/smack-im/src/main/java/org/jivesoftware/smack/roster/RosterEntry.java index 1796101c4..0eb87b81a 100644 --- a/smack-im/src/main/java/org/jivesoftware/smack/roster/RosterEntry.java +++ b/smack-im/src/main/java/org/jivesoftware/smack/roster/RosterEntry.java @@ -207,7 +207,7 @@ public final class RosterEntry extends Manager { group = iter.next(); buf.append(group.getName()); } - buf.append("]"); + buf.append(']'); } return buf.toString(); } diff --git a/smack-java7/src/main/java/org/jivesoftware/smack/java7/XmppHostnameVerifier.java b/smack-java7/src/main/java/org/jivesoftware/smack/java7/XmppHostnameVerifier.java index 71a120bfe..8ce6d9667 100644 --- a/smack-java7/src/main/java/org/jivesoftware/smack/java7/XmppHostnameVerifier.java +++ b/smack-java7/src/main/java/org/jivesoftware/smack/java7/XmppHostnameVerifier.java @@ -154,7 +154,7 @@ public class XmppHostnameVerifier implements HostnameVerifier { StringBuilder sb = new StringBuilder("No subject alternative DNS name matching " + name + " found. Tried: "); for (String nonMatchingDnsAltname : nonMatchingDnsAltnames) { - sb.append(nonMatchingDnsAltname).append(","); + sb.append(nonMatchingDnsAltname).append(','); } throw new CertificateException(sb.toString()); } @@ -279,7 +279,7 @@ public class XmppHostnameVerifier implements HostnameVerifier { StringBuilder sb = new StringBuilder("No subject alternative names matching IP address " + expectedIP + " found. Tried: "); for (String s : nonMatchingIpAltnames) { - sb.append(s).append(","); + sb.append(s).append(','); } throw new CertificateException(sb.toString()); } diff --git a/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/media/PayloadType.java b/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/media/PayloadType.java index 2b0a1d84b..c6301b3c3 100644 --- a/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/media/PayloadType.java +++ b/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/media/PayloadType.java @@ -208,17 +208,17 @@ public class PayloadType { public String toXML() { StringBuilder buf = new StringBuilder(); - buf.append("<").append(getElementName()).append(" "); + buf.append('<').append(getElementName()).append(' '); // We covert here the payload type to XML if (this.getId() != PayloadType.INVALID_PT) { - buf.append(" id=\"").append(this.getId()).append("\""); + buf.append(" id=\"").append(this.getId()).append('"'); } if (this.getName() != null) { - buf.append(" name=\"").append(this.getName()).append("\""); + buf.append(" name=\"").append(this.getName()).append('"'); } if (this.getChannels() != 0) { - buf.append(" channels=\"").append(this.getChannels()).append("\""); + buf.append(" channels=\"").append(this.getChannels()).append('"'); } if (getChildAttributes() != null) { buf.append(getChildAttributes()); diff --git a/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/nat/RTPBridge.java b/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/nat/RTPBridge.java index 423c82344..a313a2cc9 100644 --- a/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/nat/RTPBridge.java +++ b/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/nat/RTPBridge.java @@ -134,22 +134,22 @@ public class RTPBridge extends IQ { StringBuilder str = new StringBuilder(); if (getSid() != null) - str.append(" sid='").append(getSid()).append("'"); + str.append(" sid='").append(getSid()).append('\''); if (getPass() != null) - str.append(" pass='").append(getPass()).append("'"); + str.append(" pass='").append(getPass()).append('\''); if (getPortA() != -1) - str.append(" porta='").append(getPortA()).append("'"); + str.append(" porta='").append(getPortA()).append('\''); if (getPortB() != -1) - str.append(" portb='").append(getPortB()).append("'"); + str.append(" portb='").append(getPortB()).append('\''); if (getHostA() != null) - str.append(" hosta='").append(getHostA()).append("'"); + str.append(" hosta='").append(getHostA()).append('\''); if (getHostB() != null) - str.append(" hostb='").append(getHostB()).append("'"); + str.append(" hostb='").append(getHostB()).append('\''); return str.toString(); } 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 e8b20ebee..7dfe93a3e 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 @@ -345,18 +345,18 @@ public class Jingle extends IQ { */ protected IQChildElementXmlStringBuilder getIQChildElementBuilder(IQChildElementXmlStringBuilder buf) { if (getInitiator() != null) { - buf.append(" initiator=\"").append(getInitiator()).append("\""); + buf.append(" initiator=\"").append(getInitiator()).append('"'); } if (getResponder() != null) { - buf.append(" responder=\"").append(getResponder()).append("\""); + buf.append(" responder=\"").append(getResponder()).append('"'); } if (getAction() != null) { - buf.append(" action=\"").append(getAction().name()).append("\""); + buf.append(" action=\"").append(getAction().name()).append('"'); } if (getSid() != null) { - buf.append(" sid=\"").append(getSid()).append("\""); + buf.append(" sid=\"").append(getSid()).append('"'); } - buf.append(">"); + buf.append('>'); synchronized (contents) { for (JingleContent content : contents) { 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 f57e75470..9f0380139 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 @@ -162,7 +162,7 @@ public class JingleContent implements ExtensionElement { synchronized (transports) { - buf.append("<").append(getElementName()); + buf.append('<').append(getElementName()); buf.append(" creator='" + creator + "' name='" + name + "'>"); @@ -175,7 +175,7 @@ public class JingleContent implements ExtensionElement { for (JingleTransport transport : transports) { buf.append(transport.toXML()); } - buf.append(""); + buf.append("'); } return buf.toString(); } 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 d746f1cc0..e9759404b 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 @@ -149,7 +149,7 @@ public abstract class JingleContentDescription implements ExtensionElement { synchronized (payloads) { if (payloads.size() > 0) { - buf.append("<").append(getElementName()); + buf.append('<').append(getElementName()); buf.append(" xmlns=\"").append(getNamespace()).append("\" >"); Iterator pt = payloads.listIterator(); @@ -157,7 +157,7 @@ public abstract class JingleContentDescription implements ExtensionElement { JinglePayloadType pte = pt.next(); buf.append(pte.toXML()); } - buf.append(""); + buf.append("'); } } @@ -251,17 +251,17 @@ public abstract class JingleContentDescription implements ExtensionElement { StringBuilder buf = new StringBuilder(); if (payload != null) { - buf.append("<").append(getElementName()).append(" "); + buf.append('<').append(getElementName()).append(' '); // We covert here the payload type to XML if (payload.getId() != PayloadType.INVALID_PT) { - buf.append(" id=\"").append(payload.getId()).append("\""); + buf.append(" id=\"").append(payload.getId()).append('"'); } if (payload.getName() != null) { - buf.append(" name=\"").append(payload.getName()).append("\""); + buf.append(" name=\"").append(payload.getName()).append('"'); } if (payload.getChannels() != 0) { - buf.append(" channels=\"").append(payload.getChannels()).append("\""); + buf.append(" channels=\"").append(payload.getChannels()).append('"'); } if (getChildAttributes() != null) { buf.append(getChildAttributes()); 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 e8369a3a4..b37ee5831 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 @@ -82,7 +82,7 @@ public class JingleContentInfo implements ExtensionElement { public String toXML() { StringBuilder buf = new StringBuilder(); - buf.append("<").append(getElementName()).append(" xmlns=\""); + buf.append('<').append(getElementName()).append(" xmlns=\""); buf.append(getNamespace()).append("\" "); buf.append("/>"); return buf.toString(); 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 eb0b34d59..aedc1a7b3 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 @@ -156,7 +156,7 @@ public abstract class JingleDescription implements ExtensionElement { synchronized (payloads) { if (payloads.size() > 0) { - buf.append("<").append(getElementName()); + buf.append('<').append(getElementName()); buf.append(" xmlns=\"").append(getNamespace()).append("\" >"); for (PayloadType payloadType : payloads) { @@ -164,7 +164,7 @@ public abstract class JingleDescription implements ExtensionElement { buf.append(payloadType.toXML()); } } - buf.append(""); + buf.append("'); } } 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 e868ebede..e7b22110b 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 @@ -77,7 +77,7 @@ public class JingleError implements ExtensionElement { StringBuilder buf = new StringBuilder(); if (message != null) { buf.append(""); - buf.append("<").append(message).append(" xmlns=\"").append(NAMESPACE).append( + buf.append('<').append(message).append(" xmlns=\"").append(NAMESPACE).append( "\"/>"); 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 c1117cdfa..c525d5194 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 @@ -151,19 +151,19 @@ public class JingleTransport implements ExtensionElement { public String toXML() { StringBuilder buf = new StringBuilder(); - buf.append("<").append(getElementName()).append(" xmlns=\""); + buf.append('<').append(getElementName()).append(" xmlns=\""); buf.append(getNamespace()).append("\" "); synchronized (candidates) { if (getCandidatesCount() > 0) { - buf.append(">"); + buf.append('>'); Iterator iter = getCandidates(); while (iter.hasNext()) { JingleTransportCandidate candidate = iter.next(); buf.append(candidate.toXML()); } - buf.append(""); + buf.append("'); } else { buf.append("/>"); } @@ -251,7 +251,7 @@ public class JingleTransport implements ExtensionElement { String childElements = getChildElements(); if (transportCandidate != null && childElements != null) { - buf.append("<").append(getElementName()).append(" "); + buf.append('<').append(getElementName()).append(' '); buf.append(childElements); buf.append("/>"); } @@ -323,18 +323,18 @@ public class JingleTransport implements ExtensionElement { ICECandidate tci = (ICECandidate) transportCandidate; // We convert the transportElement candidate to XML here... - buf.append(" generation=\"").append(tci.getGeneration()).append("\""); - buf.append(" ip=\"").append(tci.getIp()).append("\""); - buf.append(" port=\"").append(tci.getPort()).append("\""); - buf.append(" network=\"").append(tci.getNetwork()).append("\""); - buf.append(" username=\"").append(tci.getUsername()).append("\""); - buf.append(" password=\"").append(tci.getPassword()).append("\""); - buf.append(" preference=\"").append(tci.getPreference()).append("\""); - buf.append(" type=\"").append(tci.getType()).append("\""); + buf.append(" generation=\"").append(tci.getGeneration()).append('"'); + buf.append(" ip=\"").append(tci.getIp()).append('"'); + buf.append(" port=\"").append(tci.getPort()).append('"'); + buf.append(" network=\"").append(tci.getNetwork()).append('"'); + buf.append(" username=\"").append(tci.getUsername()).append('"'); + buf.append(" password=\"").append(tci.getPassword()).append('"'); + buf.append(" preference=\"").append(tci.getPreference()).append('"'); + buf.append(" type=\"").append(tci.getType()).append('"'); // Optional elements if (transportCandidate.getName() != null) { - buf.append(" name=\"").append(tci.getName()).append("\""); + buf.append(" name=\"").append(tci.getName()).append('"'); } } @@ -408,14 +408,14 @@ public class JingleTransport implements ExtensionElement { if (transportCandidate != null && transportCandidate instanceof TransportCandidate.Fixed) { TransportCandidate.Fixed tcf = (TransportCandidate.Fixed) transportCandidate; - buf.append(" generation=\"").append(tcf.getGeneration()).append("\""); - buf.append(" ip=\"").append(tcf.getIp()).append("\""); - buf.append(" port=\"").append(tcf.getPort()).append("\""); + buf.append(" generation=\"").append(tcf.getGeneration()).append('"'); + buf.append(" ip=\"").append(tcf.getIp()).append('"'); + buf.append(" port=\"").append(tcf.getPort()).append('"'); // Optional parameters String name = tcf.getName(); if (name != null) { - buf.append(" name=\"").append(name).append("\""); + buf.append(" name=\"").append(name).append('"'); } } return buf.toString(); 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 37a834218..164d9de44 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 @@ -91,11 +91,11 @@ public class AgentStatus implements ExtensionElement { public String toXML() { StringBuilder buf = new StringBuilder(); - buf.append("<").append(ELEMENT_NAME).append(" xmlns=\"").append(NAMESPACE).append("\""); + buf.append('<').append(ELEMENT_NAME).append(" xmlns=\"").append(NAMESPACE).append('"'); if (workgroupJID != null) { - buf.append(" jid=\"").append(workgroupJID).append("\""); + buf.append(" jid=\"").append(workgroupJID).append('"'); } - buf.append(">"); + buf.append('>'); if (maxChats != -1) { buf.append("").append(maxChats).append(""); } @@ -197,22 +197,22 @@ public class AgentStatus implements ExtensionElement { buf.append(""); 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 8d11ebb2c..341d54f96 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 @@ -108,7 +108,7 @@ public final class QueueDetails implements ExtensionElement { public String toXML() { StringBuilder buf = new StringBuilder(); - buf.append("<").append(ELEMENT_NAME).append(" xmlns=\"").append(NAMESPACE).append("\">"); + buf.append('<').append(ELEMENT_NAME).append(" xmlns=\"").append(NAMESPACE).append("\">"); synchronized (users) { for (Iterator i=users.iterator(); i.hasNext(); ) { @@ -136,7 +136,7 @@ public final class QueueDetails implements ExtensionElement { buf.append(""); } } - buf.append(""); + buf.append("'); return buf.toString(); } 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 b263a54ca..64aa88005 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 @@ -98,7 +98,7 @@ public class QueueOverview implements ExtensionElement { public String toXML () { StringBuilder buf = new StringBuilder(); - buf.append("<").append(ELEMENT_NAME).append(" xmlns=\"").append(NAMESPACE).append("\">"); + buf.append('<').append(ELEMENT_NAME).append(" xmlns=\"").append(NAMESPACE).append("\">"); if (userCount != -1) { buf.append("").append(userCount).append(""); @@ -112,7 +112,7 @@ public class QueueOverview implements ExtensionElement { if (status != null) { buf.append("").append(status).append(""); } - buf.append(""); + buf.append("'); return buf.toString(); } 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 9e64852e2..e8cd700bb 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 @@ -57,7 +57,7 @@ public class SessionID implements ExtensionElement { public String toXML() { StringBuilder buf = new StringBuilder(); - buf.append("<").append(ELEMENT_NAME).append(" xmlns=\"").append(NAMESPACE).append("\" "); + buf.append('<').append(ELEMENT_NAME).append(" xmlns=\"").append(NAMESPACE).append("\" "); buf.append("id=\"").append(this.getSessionID()); buf.append("\"/>"); 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 dbcbec2ea..ba2ecee0a 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 @@ -59,7 +59,7 @@ public class UserID implements ExtensionElement { public String toXML() { StringBuilder buf = new StringBuilder(); - buf.append("<").append(ELEMENT_NAME).append(" xmlns=\"").append(NAMESPACE).append("\" "); + buf.append('<').append(ELEMENT_NAME).append(" xmlns=\"").append(NAMESPACE).append("\" "); buf.append("id=\"").append(this.getUserID()); buf.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 3d8837c53..9250d45e4 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 @@ -62,7 +62,7 @@ public class WorkgroupInformation implements ExtensionElement { StringBuilder buf = new StringBuilder(); buf.append('<').append(ELEMENT_NAME); - buf.append(" jid=\"").append(getWorkgroupJID()).append("\""); + buf.append(" jid=\"").append(getWorkgroupJID()).append('"'); buf.append(" xmlns=\"").append(NAMESPACE).append("\" />"); return buf.toString(); diff --git a/smack-legacy/src/main/java/org/jivesoftware/smackx/workgroup/settings/GenericSettings.java b/smack-legacy/src/main/java/org/jivesoftware/smackx/workgroup/settings/GenericSettings.java index 8bea4f59a..a8f117f53 100644 --- a/smack-legacy/src/main/java/org/jivesoftware/smackx/workgroup/settings/GenericSettings.java +++ b/smack-legacy/src/main/java/org/jivesoftware/smackx/workgroup/settings/GenericSettings.java @@ -66,7 +66,7 @@ public class GenericSettings extends IQ { @Override protected IQChildElementXmlStringBuilder getIQChildElementBuilder(IQChildElementXmlStringBuilder buf) { - buf.append(">"); + buf.append('>'); if (ModelUtil.hasLength(getQuery())) { buf.append("" + getQuery() + ""); } 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 0a571a288..81dd8ca3a 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 @@ -305,30 +305,30 @@ public class MessageEvent implements ExtensionElement { */ public String toXML() { StringBuilder buf = new StringBuilder(); - buf.append("<").append(getElementName()).append(" xmlns=\"").append(getNamespace()).append( + buf.append('<').append(getElementName()).append(" xmlns=\"").append(getNamespace()).append( "\">"); // Note: Cancellation events don't specify any tag. They just send the packetID // Add the offline tag if the sender requests to be notified of offline events or if // the target is offline if (isOffline()) - buf.append("<").append(MessageEvent.OFFLINE).append("/>"); + buf.append('<').append(MessageEvent.OFFLINE).append("/>"); // Add the delivered tag if the sender requests to be notified when the message is // delivered or if the target notifies that the message has been delivered if (isDelivered()) - buf.append("<").append(MessageEvent.DELIVERED).append("/>"); + buf.append('<').append(MessageEvent.DELIVERED).append("/>"); // Add the displayed tag if the sender requests to be notified when the message is // displayed or if the target notifies that the message has been displayed if (isDisplayed()) - buf.append("<").append(MessageEvent.DISPLAYED).append("/>"); + buf.append('<').append(MessageEvent.DISPLAYED).append("/>"); // Add the composing tag if the sender requests to be notified when the target is // composing a reply or if the target notifies that he/she is composing a reply if (isComposing()) - buf.append("<").append(MessageEvent.COMPOSING).append("/>"); + buf.append('<').append(MessageEvent.COMPOSING).append("/>"); // Add the id tag only if the MessageEvent is a notification message (not a request) if (getStanzaId() != null) buf.append("").append(getStanzaId()).append(""); - buf.append(""); + buf.append("'); return buf.toString(); } diff --git a/smack-legacy/src/main/java/org/jivesoftware/smackx/xroster/RemoteRosterEntry.java b/smack-legacy/src/main/java/org/jivesoftware/smackx/xroster/RemoteRosterEntry.java index e3910508d..a84c8b2fa 100644 --- a/smack-legacy/src/main/java/org/jivesoftware/smackx/xroster/RemoteRosterEntry.java +++ b/smack-legacy/src/main/java/org/jivesoftware/smackx/xroster/RemoteRosterEntry.java @@ -100,11 +100,11 @@ public class RemoteRosterEntry { public String toXML() { StringBuilder buf = new StringBuilder(); - buf.append(""); + buf.append('>'); synchronized (groupNames) { for (String groupName : groupNames) { buf.append("").append(groupName).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 fcb1c37ac..33709768b 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 @@ -165,14 +165,14 @@ public class RosterExchange implements ExtensionElement { */ public String toXML() { StringBuilder buf = new StringBuilder(); - buf.append("<").append(getElementName()).append(" xmlns=\"").append(getNamespace()).append( + buf.append('<').append(getElementName()).append(" xmlns=\"").append(getNamespace()).append( "\">"); // Loop through all roster entries and append them to the string buffer for (Iterator i = getRosterEntries(); i.hasNext();) { RemoteRosterEntry remoteRosterEntry = i.next(); buf.append(remoteRosterEntry.toXML()); } - buf.append(""); + buf.append("'); return buf.toString(); }