mirror of
https://codeberg.org/Mercury-IM/Smack
synced 2024-11-22 14:22:05 +01:00
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).
This commit is contained in:
parent
19ebcb814b
commit
e0e4fd9b12
46 changed files with 159 additions and 142 deletions
|
@ -19,6 +19,18 @@
|
||||||
<property name="format" value="MXParser"/>
|
<property name="format" value="MXParser"/>
|
||||||
<property name="message" value="Must not use MXParser, use XmlPullParserFactory instead"/>
|
<property name="message" value="Must not use MXParser, use XmlPullParserFactory instead"/>
|
||||||
</module>
|
</module>
|
||||||
|
<module name="RegexpSingleline">
|
||||||
|
<!--
|
||||||
|
Matches StringBuilder.append(String) calls where the
|
||||||
|
argument is a String of length one. Those should be replaced
|
||||||
|
with append(char) for performance reasons.
|
||||||
|
|
||||||
|
TODO: This could be more advanced in order to match also
|
||||||
|
- .append("\u1234")
|
||||||
|
-->
|
||||||
|
<property name="format" value="\.append\("(.|\\.)"\)"/>
|
||||||
|
<property name="message" value="Don't use StringBuilder.append(String) when you can use StringBuilder.append(char). Solution: Replace double quotes of append's argument with single quotes."/>
|
||||||
|
</module>
|
||||||
<module name="RegexpSingleline">
|
<module name="RegexpSingleline">
|
||||||
<property name="format" value="^\s+$"/>
|
<property name="format" value="^\s+$"/>
|
||||||
<property name="message" value="Line containing only whitespace character(s)"/>
|
<property name="message" value="Line containing only whitespace character(s)"/>
|
||||||
|
|
|
@ -160,7 +160,7 @@ public class MessageTest extends SmackTestCase {
|
||||||
Message msg = new Message(getFullJID(1), Message.Type.chat);
|
Message msg = new Message(getFullJID(1), Message.Type.chat);
|
||||||
StringBuilder sb = new StringBuilder(5000);
|
StringBuilder sb = new StringBuilder(5000);
|
||||||
for (int i = 0; i <= 4000; i++) {
|
for (int i = 0; i <= 4000; i++) {
|
||||||
sb.append("X");
|
sb.append('X');
|
||||||
}
|
}
|
||||||
msg.setBody(sb.toString());
|
msg.setBody(sb.toString());
|
||||||
|
|
||||||
|
|
|
@ -19,10 +19,10 @@ package org.jivesoftware.smack.filter;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.Iterator;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.jivesoftware.smack.util.Objects;
|
import org.jivesoftware.smack.util.Objects;
|
||||||
|
import org.jivesoftware.smack.util.StringUtils;
|
||||||
|
|
||||||
public abstract class AbstractListFilter implements StanzaFilter {
|
public abstract class AbstractListFilter implements StanzaFilter {
|
||||||
|
|
||||||
|
@ -67,14 +67,8 @@ public abstract class AbstractListFilter implements StanzaFilter {
|
||||||
StringBuilder sb = new StringBuilder();
|
StringBuilder sb = new StringBuilder();
|
||||||
sb.append(getClass().getSimpleName());
|
sb.append(getClass().getSimpleName());
|
||||||
sb.append(": (");
|
sb.append(": (");
|
||||||
for (Iterator<StanzaFilter> it = filters.iterator(); it.hasNext();) {
|
sb.append(StringUtils.toStringBuilder(filters, ", "));
|
||||||
StanzaFilter filter = it.next();
|
sb.append(')');
|
||||||
sb.append(filter.toString());
|
|
||||||
if (it.hasNext()) {
|
|
||||||
sb.append(", ");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
sb.append(")");
|
|
||||||
return sb.toString();
|
return sb.toString();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -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.
|
* @param collection the collection to transform.
|
||||||
* @return a String with all the elements of the collection.
|
* @return a String with all the elements of the collection.
|
||||||
*/
|
*/
|
||||||
public static String collectionToString(Collection<? extends CharSequence> collection) {
|
public static String collectionToString(Collection<? extends Object> 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<? extends Object> collection, String delimiter) {
|
||||||
StringBuilder sb = new StringBuilder(collection.size() * 20);
|
StringBuilder sb = new StringBuilder(collection.size() * 20);
|
||||||
for (Iterator<? extends CharSequence> it = collection.iterator(); it.hasNext();) {
|
for (Iterator<? extends Object> it = collection.iterator(); it.hasNext();) {
|
||||||
CharSequence cs = it.next();
|
Object cs = it.next();
|
||||||
sb.append(cs);
|
sb.append(cs);
|
||||||
if (it.hasNext()) {
|
if (it.hasNext()) {
|
||||||
sb.append(' ');
|
sb.append(delimiter);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return sb.toString();
|
return sb;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String returnIfNotEmptyTrimmed(String string) {
|
public static String returnIfNotEmptyTrimmed(String string) {
|
||||||
|
|
|
@ -201,7 +201,7 @@ public class MultipleAddresses implements ExtensionElement {
|
||||||
buf.optAttribute("desc", description);
|
buf.optAttribute("desc", description);
|
||||||
if (description != null && description.trim().length() > 0) {
|
if (description != null && description.trim().length() > 0) {
|
||||||
buf.append(" desc=\"");
|
buf.append(" desc=\"");
|
||||||
buf.append(description).append("\"");
|
buf.append(description).append('"');
|
||||||
}
|
}
|
||||||
buf.optBooleanAttribute("delivered", delivered);
|
buf.optBooleanAttribute("delivered", delivered);
|
||||||
buf.optAttribute("uri", uri);
|
buf.optAttribute("uri", uri);
|
||||||
|
|
|
@ -155,27 +155,27 @@ public class AMPExtension implements ExtensionElement {
|
||||||
@Override
|
@Override
|
||||||
public String toXML() {
|
public String toXML() {
|
||||||
StringBuilder buf = new StringBuilder();
|
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) {
|
if (status != null) {
|
||||||
buf.append(" status=\"").append(status.toString()).append("\"");
|
buf.append(" status=\"").append(status.toString()).append('"');
|
||||||
}
|
}
|
||||||
if (to != null) {
|
if (to != null) {
|
||||||
buf.append(" to=\"").append(to).append("\"");
|
buf.append(" to=\"").append(to).append('"');
|
||||||
}
|
}
|
||||||
if (from != null) {
|
if (from != null) {
|
||||||
buf.append(" from=\"").append(from).append("\"");
|
buf.append(" from=\"").append(from).append('"');
|
||||||
}
|
}
|
||||||
if (perHop) {
|
if (perHop) {
|
||||||
buf.append(" per-hop=\"true\"");
|
buf.append(" per-hop=\"true\"");
|
||||||
}
|
}
|
||||||
buf.append(">");
|
buf.append('>');
|
||||||
|
|
||||||
// Loop through all the rules and append them to the string buffer
|
// Loop through all the rules and append them to the string buffer
|
||||||
for (Rule rule : getRules()) {
|
for (Rule rule : getRules()) {
|
||||||
buf.append(rule.toXML());
|
buf.append(rule.toXML());
|
||||||
}
|
}
|
||||||
|
|
||||||
buf.append("</").append(getElementName()).append(">");
|
buf.append("</").append(getElementName()).append('>');
|
||||||
return buf.toString();
|
return buf.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -67,7 +67,7 @@ public class AttentionExtension implements ExtensionElement {
|
||||||
*/
|
*/
|
||||||
public String toXML() {
|
public String toXML() {
|
||||||
final StringBuilder sb = new StringBuilder();
|
final StringBuilder sb = new StringBuilder();
|
||||||
sb.append("<").append(getElementName()).append(" xmlns=\"").append(
|
sb.append('<').append(getElementName()).append(" xmlns=\"").append(
|
||||||
getNamespace()).append("\"/>");
|
getNamespace()).append("\"/>");
|
||||||
return sb.toString();
|
return sb.toString();
|
||||||
}
|
}
|
||||||
|
|
|
@ -631,13 +631,13 @@ public final class EntityCapsManager extends Manager {
|
||||||
// followed by the '<' character.
|
// followed by the '<' character.
|
||||||
for (DiscoverInfo.Identity identity : sortedIdentities) {
|
for (DiscoverInfo.Identity identity : sortedIdentities) {
|
||||||
sb.append(identity.getCategory());
|
sb.append(identity.getCategory());
|
||||||
sb.append("/");
|
sb.append('/');
|
||||||
sb.append(identity.getType());
|
sb.append(identity.getType());
|
||||||
sb.append("/");
|
sb.append('/');
|
||||||
sb.append(identity.getLanguage() == null ? "" : identity.getLanguage());
|
sb.append(identity.getLanguage() == null ? "" : identity.getLanguage());
|
||||||
sb.append("/");
|
sb.append('/');
|
||||||
sb.append(identity.getName() == null ? "" : identity.getName());
|
sb.append(identity.getName() == null ? "" : identity.getName());
|
||||||
sb.append("<");
|
sb.append('<');
|
||||||
}
|
}
|
||||||
|
|
||||||
// 4. Sort the supported service discovery features.
|
// 4. Sort the supported service discovery features.
|
||||||
|
@ -649,7 +649,7 @@ public final class EntityCapsManager extends Manager {
|
||||||
// character
|
// character
|
||||||
for (String f : features) {
|
for (String f : features) {
|
||||||
sb.append(f);
|
sb.append(f);
|
||||||
sb.append("<");
|
sb.append('<');
|
||||||
}
|
}
|
||||||
|
|
||||||
// only use the data form for calculation is it has a hidden FORM_TYPE
|
// 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.
|
// followed by the '<' character.
|
||||||
for (FormField f : fs) {
|
for (FormField f : fs) {
|
||||||
sb.append(f.getVariable());
|
sb.append(f.getVariable());
|
||||||
sb.append("<");
|
sb.append('<');
|
||||||
formFieldValuesToCaps(f.getValues(), sb);
|
formFieldValuesToCaps(f.getValues(), sb);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -719,7 +719,7 @@ public final class EntityCapsManager extends Manager {
|
||||||
}
|
}
|
||||||
for (String fv : fvs) {
|
for (String fv : fvs) {
|
||||||
sb.append(fv);
|
sb.append(fv);
|
||||||
sb.append("<");
|
sb.append('<');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -261,7 +261,7 @@ public class AdHocCommandData extends IQ {
|
||||||
|
|
||||||
public String toXML() {
|
public String toXML() {
|
||||||
StringBuilder buf = new StringBuilder();
|
StringBuilder buf = new StringBuilder();
|
||||||
buf.append("<").append(getElementName());
|
buf.append('<').append(getElementName());
|
||||||
buf.append(" xmlns=\"").append(getNamespace()).append("\"/>");
|
buf.append(" xmlns=\"").append(getNamespace()).append("\"/>");
|
||||||
return buf.toString();
|
return buf.toString();
|
||||||
}
|
}
|
||||||
|
|
|
@ -81,14 +81,14 @@ public class DefaultPrivateData implements PrivateData {
|
||||||
|
|
||||||
public String toXML() {
|
public String toXML() {
|
||||||
StringBuilder buf = new StringBuilder();
|
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()) {
|
for (String name : getNames()) {
|
||||||
String value = getValue(name);
|
String value = getValue(name);
|
||||||
buf.append("<").append(name).append(">");
|
buf.append('<').append(name).append('>');
|
||||||
buf.append(value);
|
buf.append(value);
|
||||||
buf.append("</").append(name).append(">");
|
buf.append("</").append(name).append('>');
|
||||||
}
|
}
|
||||||
buf.append("</").append(elementName).append(">");
|
buf.append("</").append(elementName).append('>');
|
||||||
return buf.toString();
|
return buf.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -86,7 +86,7 @@ public class Nick implements ExtensionElement {
|
||||||
public String toXML() {
|
public String toXML() {
|
||||||
final StringBuilder buf = new StringBuilder();
|
final StringBuilder buf = new StringBuilder();
|
||||||
|
|
||||||
buf.append("<").append(ELEMENT_NAME).append(" xmlns=\"").append(
|
buf.append('<').append(ELEMENT_NAME).append(" xmlns=\"").append(
|
||||||
NAMESPACE).append("\">");
|
NAMESPACE).append("\">");
|
||||||
buf.append(getName());
|
buf.append(getName());
|
||||||
buf.append("</").append(ELEMENT_NAME).append('>');
|
buf.append("</").append(ELEMENT_NAME).append('>');
|
||||||
|
|
|
@ -80,11 +80,11 @@ public class OfflineMessageInfo implements ExtensionElement {
|
||||||
|
|
||||||
public String toXML() {
|
public String toXML() {
|
||||||
StringBuilder buf = new StringBuilder();
|
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)
|
if (getNode() != null)
|
||||||
buf.append("<item node=\"").append(getNode()).append("\"/>");
|
buf.append("<item node=\"").append(getNode()).append("\"/>");
|
||||||
buf.append("</").append(getElementName()).append(">");
|
buf.append("</").append(getElementName()).append('>');
|
||||||
return buf.toString();
|
return buf.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -182,13 +182,13 @@ public class OfflineMessageRequest extends IQ {
|
||||||
StringBuilder buf = new StringBuilder();
|
StringBuilder buf = new StringBuilder();
|
||||||
buf.append("<item");
|
buf.append("<item");
|
||||||
if (getAction() != null) {
|
if (getAction() != null) {
|
||||||
buf.append(" action=\"").append(getAction()).append("\"");
|
buf.append(" action=\"").append(getAction()).append('"');
|
||||||
}
|
}
|
||||||
if (getJid() != null) {
|
if (getJid() != null) {
|
||||||
buf.append(" jid=\"").append(getJid()).append("\"");
|
buf.append(" jid=\"").append(getJid()).append('"');
|
||||||
}
|
}
|
||||||
if (getNode() != null) {
|
if (getNode() != null) {
|
||||||
buf.append(" node=\"").append(getNode()).append("\"");
|
buf.append(" node=\"").append(getNode()).append('"');
|
||||||
}
|
}
|
||||||
buf.append("/>");
|
buf.append("/>");
|
||||||
return buf.toString();
|
return buf.toString();
|
||||||
|
|
|
@ -93,9 +93,9 @@ public class PEPEvent implements ExtensionElement {
|
||||||
*/
|
*/
|
||||||
public String toXML() {
|
public String toXML() {
|
||||||
StringBuilder buf = new StringBuilder();
|
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(item.toXML());
|
||||||
buf.append("</").append(getElementName()).append(">");
|
buf.append("</").append(getElementName()).append('>');
|
||||||
return buf.toString();
|
return buf.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -80,9 +80,9 @@ public abstract class PEPItem implements ExtensionElement {
|
||||||
*/
|
*/
|
||||||
public String toXML() {
|
public String toXML() {
|
||||||
StringBuilder buf = new StringBuilder();
|
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(getItemDetailsXML());
|
||||||
buf.append("</").append(getElementName()).append(">");
|
buf.append("</").append(getElementName()).append('>');
|
||||||
return buf.toString();
|
return buf.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -296,17 +296,17 @@ public class PrivacyItem {
|
||||||
} else {
|
} else {
|
||||||
buf.append(" action=\"deny\"");
|
buf.append(" action=\"deny\"");
|
||||||
}
|
}
|
||||||
buf.append(" order=\"").append(getOrder()).append("\"");
|
buf.append(" order=\"").append(getOrder()).append('"');
|
||||||
if (getType() != null) {
|
if (getType() != null) {
|
||||||
buf.append(" type=\"").append(getType()).append("\"");
|
buf.append(" type=\"").append(getType()).append('"');
|
||||||
}
|
}
|
||||||
if (getValue() != null) {
|
if (getValue() != null) {
|
||||||
buf.append(" value=\"").append(getValue()).append("\"");
|
buf.append(" value=\"").append(getValue()).append('"');
|
||||||
}
|
}
|
||||||
if (isFilterEverything()) {
|
if (isFilterEverything()) {
|
||||||
buf.append("/>");
|
buf.append("/>");
|
||||||
} else {
|
} else {
|
||||||
buf.append(">");
|
buf.append('>');
|
||||||
if (this.isFilterIQ()) {
|
if (this.isFilterIQ()) {
|
||||||
buf.append("<iq/>");
|
buf.append("<iq/>");
|
||||||
}
|
}
|
||||||
|
|
|
@ -122,13 +122,13 @@ public class Item extends NodeExtension
|
||||||
{
|
{
|
||||||
builder.append(" id='");
|
builder.append(" id='");
|
||||||
builder.append(id);
|
builder.append(id);
|
||||||
builder.append("'");
|
builder.append('\'');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (getNode() != null) {
|
if (getNode() != null) {
|
||||||
builder.append(" node='");
|
builder.append(" node='");
|
||||||
builder.append(getNode());
|
builder.append(getNode());
|
||||||
builder.append("'");
|
builder.append('\'');
|
||||||
}
|
}
|
||||||
builder.append("/>");
|
builder.append("/>");
|
||||||
|
|
||||||
|
|
|
@ -183,7 +183,7 @@ public class ItemsExtension extends NodeExtension implements EmbeddedPacketExten
|
||||||
|
|
||||||
builder.append("</");
|
builder.append("</");
|
||||||
builder.append(getElementName());
|
builder.append(getElementName());
|
||||||
builder.append(">");
|
builder.append('>');
|
||||||
return builder.toString();
|
return builder.toString();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -118,15 +118,15 @@ public class PayloadItem<E extends ExtensionElement> extends Item
|
||||||
{
|
{
|
||||||
builder.append(" id='");
|
builder.append(" id='");
|
||||||
builder.append(getId());
|
builder.append(getId());
|
||||||
builder.append("'");
|
builder.append('\'');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (getNode() != null) {
|
if (getNode() != null) {
|
||||||
builder.append(" node='");
|
builder.append(" node='");
|
||||||
builder.append(getNode());
|
builder.append(getNode());
|
||||||
builder.append("'");
|
builder.append('\'');
|
||||||
}
|
}
|
||||||
builder.append(">");
|
builder.append('>');
|
||||||
builder.append(payload.toXML());
|
builder.append(payload.toXML());
|
||||||
builder.append("</item>");
|
builder.append("</item>");
|
||||||
|
|
||||||
|
|
|
@ -52,7 +52,7 @@ public class SubscribeExtension extends NodeExtension
|
||||||
{
|
{
|
||||||
builder.append(" node='");
|
builder.append(" node='");
|
||||||
builder.append(getNode());
|
builder.append(getNode());
|
||||||
builder.append("'");
|
builder.append('\'');
|
||||||
}
|
}
|
||||||
builder.append(" jid='");
|
builder.append(" jid='");
|
||||||
builder.append(getJid());
|
builder.append(getJid());
|
||||||
|
|
|
@ -153,11 +153,11 @@ public class Subscription extends NodeExtension
|
||||||
|
|
||||||
private static void appendAttribute(StringBuilder builder, String att, String value)
|
private static void appendAttribute(StringBuilder builder, String att, String value)
|
||||||
{
|
{
|
||||||
builder.append(" ");
|
builder.append(' ');
|
||||||
builder.append(att);
|
builder.append(att);
|
||||||
builder.append("='");
|
builder.append("='");
|
||||||
builder.append(value);
|
builder.append(value);
|
||||||
builder.append("'");
|
builder.append('\'');
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -81,9 +81,9 @@ public class SubscriptionsExtension extends NodeExtension
|
||||||
{
|
{
|
||||||
builder.append(" node='");
|
builder.append(" node='");
|
||||||
builder.append(getNode());
|
builder.append(getNode());
|
||||||
builder.append("'");
|
builder.append('\'');
|
||||||
}
|
}
|
||||||
builder.append(">");
|
builder.append('>');
|
||||||
|
|
||||||
for (Subscription item : items)
|
for (Subscription item : items)
|
||||||
{
|
{
|
||||||
|
@ -92,7 +92,7 @@ public class SubscriptionsExtension extends NodeExtension
|
||||||
|
|
||||||
builder.append("</");
|
builder.append("</");
|
||||||
builder.append(getElementName());
|
builder.append(getElementName());
|
||||||
builder.append(">");
|
builder.append('>');
|
||||||
return builder.toString();
|
return builder.toString();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -75,7 +75,7 @@ class SimpleUserSearch extends IQ {
|
||||||
String name = field.getVariable();
|
String name = field.getVariable();
|
||||||
String value = getSingleValue(field);
|
String value = getSingleValue(field);
|
||||||
if (value.trim().length() > 0) {
|
if (value.trim().length() > 0) {
|
||||||
buf.append("<").append(name).append(">").append(value).append("</").append(name).append(">");
|
buf.append('<').append(name).append('>').append(value).append("</").append(name).append('>');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -328,7 +328,7 @@ public class StreamInitiation extends IQ {
|
||||||
public String toXML() {
|
public String toXML() {
|
||||||
StringBuilder buffer = new StringBuilder();
|
StringBuilder buffer = new StringBuilder();
|
||||||
|
|
||||||
buffer.append("<").append(getElementName()).append(" xmlns=\"")
|
buffer.append('<').append(getElementName()).append(" xmlns=\"")
|
||||||
.append(getNamespace()).append("\" ");
|
.append(getNamespace()).append("\" ");
|
||||||
|
|
||||||
if (getName() != null) {
|
if (getName() != null) {
|
||||||
|
@ -348,14 +348,14 @@ public class StreamInitiation extends IQ {
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((desc != null && desc.length() > 0) || isRanged) {
|
if ((desc != null && desc.length() > 0) || isRanged) {
|
||||||
buffer.append(">");
|
buffer.append('>');
|
||||||
if (getDesc() != null && desc.length() > 0) {
|
if (getDesc() != null && desc.length() > 0) {
|
||||||
buffer.append("<desc>").append(StringUtils.escapeForXML(getDesc())).append("</desc>");
|
buffer.append("<desc>").append(StringUtils.escapeForXML(getDesc())).append("</desc>");
|
||||||
}
|
}
|
||||||
if (isRanged()) {
|
if (isRanged()) {
|
||||||
buffer.append("<range/>");
|
buffer.append("<range/>");
|
||||||
}
|
}
|
||||||
buffer.append("</").append(getElementName()).append(">");
|
buffer.append("</").append(getElementName()).append('>');
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
buffer.append("/>");
|
buffer.append("/>");
|
||||||
|
|
|
@ -376,7 +376,7 @@ public class Form {
|
||||||
sb.append(it.next());
|
sb.append(it.next());
|
||||||
// If this is not the last instruction then append a newline
|
// If this is not the last instruction then append a newline
|
||||||
if (it.hasNext()) {
|
if (it.hasNext()) {
|
||||||
sb.append("\n");
|
sb.append('\n');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return sb.toString();
|
return sb.toString();
|
||||||
|
|
|
@ -207,7 +207,7 @@ public final class RosterEntry extends Manager {
|
||||||
group = iter.next();
|
group = iter.next();
|
||||||
buf.append(group.getName());
|
buf.append(group.getName());
|
||||||
}
|
}
|
||||||
buf.append("]");
|
buf.append(']');
|
||||||
}
|
}
|
||||||
return buf.toString();
|
return buf.toString();
|
||||||
}
|
}
|
||||||
|
|
|
@ -154,7 +154,7 @@ public class XmppHostnameVerifier implements HostnameVerifier {
|
||||||
StringBuilder sb = new StringBuilder("No subject alternative DNS name matching "
|
StringBuilder sb = new StringBuilder("No subject alternative DNS name matching "
|
||||||
+ name + " found. Tried: ");
|
+ name + " found. Tried: ");
|
||||||
for (String nonMatchingDnsAltname : nonMatchingDnsAltnames) {
|
for (String nonMatchingDnsAltname : nonMatchingDnsAltnames) {
|
||||||
sb.append(nonMatchingDnsAltname).append(",");
|
sb.append(nonMatchingDnsAltname).append(',');
|
||||||
}
|
}
|
||||||
throw new CertificateException(sb.toString());
|
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 "
|
StringBuilder sb = new StringBuilder("No subject alternative names matching IP address "
|
||||||
+ expectedIP + " found. Tried: ");
|
+ expectedIP + " found. Tried: ");
|
||||||
for (String s : nonMatchingIpAltnames) {
|
for (String s : nonMatchingIpAltnames) {
|
||||||
sb.append(s).append(",");
|
sb.append(s).append(',');
|
||||||
}
|
}
|
||||||
throw new CertificateException(sb.toString());
|
throw new CertificateException(sb.toString());
|
||||||
}
|
}
|
||||||
|
|
|
@ -208,17 +208,17 @@ public class PayloadType {
|
||||||
public String toXML() {
|
public String toXML() {
|
||||||
StringBuilder buf = new StringBuilder();
|
StringBuilder buf = new StringBuilder();
|
||||||
|
|
||||||
buf.append("<").append(getElementName()).append(" ");
|
buf.append('<').append(getElementName()).append(' ');
|
||||||
|
|
||||||
// We covert here the payload type to XML
|
// We covert here the payload type to XML
|
||||||
if (this.getId() != PayloadType.INVALID_PT) {
|
if (this.getId() != PayloadType.INVALID_PT) {
|
||||||
buf.append(" id=\"").append(this.getId()).append("\"");
|
buf.append(" id=\"").append(this.getId()).append('"');
|
||||||
}
|
}
|
||||||
if (this.getName() != null) {
|
if (this.getName() != null) {
|
||||||
buf.append(" name=\"").append(this.getName()).append("\"");
|
buf.append(" name=\"").append(this.getName()).append('"');
|
||||||
}
|
}
|
||||||
if (this.getChannels() != 0) {
|
if (this.getChannels() != 0) {
|
||||||
buf.append(" channels=\"").append(this.getChannels()).append("\"");
|
buf.append(" channels=\"").append(this.getChannels()).append('"');
|
||||||
}
|
}
|
||||||
if (getChildAttributes() != null) {
|
if (getChildAttributes() != null) {
|
||||||
buf.append(getChildAttributes());
|
buf.append(getChildAttributes());
|
||||||
|
|
|
@ -134,22 +134,22 @@ public class RTPBridge extends IQ {
|
||||||
StringBuilder str = new StringBuilder();
|
StringBuilder str = new StringBuilder();
|
||||||
|
|
||||||
if (getSid() != null)
|
if (getSid() != null)
|
||||||
str.append(" sid='").append(getSid()).append("'");
|
str.append(" sid='").append(getSid()).append('\'');
|
||||||
|
|
||||||
if (getPass() != null)
|
if (getPass() != null)
|
||||||
str.append(" pass='").append(getPass()).append("'");
|
str.append(" pass='").append(getPass()).append('\'');
|
||||||
|
|
||||||
if (getPortA() != -1)
|
if (getPortA() != -1)
|
||||||
str.append(" porta='").append(getPortA()).append("'");
|
str.append(" porta='").append(getPortA()).append('\'');
|
||||||
|
|
||||||
if (getPortB() != -1)
|
if (getPortB() != -1)
|
||||||
str.append(" portb='").append(getPortB()).append("'");
|
str.append(" portb='").append(getPortB()).append('\'');
|
||||||
|
|
||||||
if (getHostA() != null)
|
if (getHostA() != null)
|
||||||
str.append(" hosta='").append(getHostA()).append("'");
|
str.append(" hosta='").append(getHostA()).append('\'');
|
||||||
|
|
||||||
if (getHostB() != null)
|
if (getHostB() != null)
|
||||||
str.append(" hostb='").append(getHostB()).append("'");
|
str.append(" hostb='").append(getHostB()).append('\'');
|
||||||
|
|
||||||
return str.toString();
|
return str.toString();
|
||||||
}
|
}
|
||||||
|
|
|
@ -345,18 +345,18 @@ public class Jingle extends IQ {
|
||||||
*/
|
*/
|
||||||
protected IQChildElementXmlStringBuilder getIQChildElementBuilder(IQChildElementXmlStringBuilder buf) {
|
protected IQChildElementXmlStringBuilder getIQChildElementBuilder(IQChildElementXmlStringBuilder buf) {
|
||||||
if (getInitiator() != null) {
|
if (getInitiator() != null) {
|
||||||
buf.append(" initiator=\"").append(getInitiator()).append("\"");
|
buf.append(" initiator=\"").append(getInitiator()).append('"');
|
||||||
}
|
}
|
||||||
if (getResponder() != null) {
|
if (getResponder() != null) {
|
||||||
buf.append(" responder=\"").append(getResponder()).append("\"");
|
buf.append(" responder=\"").append(getResponder()).append('"');
|
||||||
}
|
}
|
||||||
if (getAction() != null) {
|
if (getAction() != null) {
|
||||||
buf.append(" action=\"").append(getAction().name()).append("\"");
|
buf.append(" action=\"").append(getAction().name()).append('"');
|
||||||
}
|
}
|
||||||
if (getSid() != null) {
|
if (getSid() != null) {
|
||||||
buf.append(" sid=\"").append(getSid()).append("\"");
|
buf.append(" sid=\"").append(getSid()).append('"');
|
||||||
}
|
}
|
||||||
buf.append(">");
|
buf.append('>');
|
||||||
|
|
||||||
synchronized (contents) {
|
synchronized (contents) {
|
||||||
for (JingleContent content : contents) {
|
for (JingleContent content : contents) {
|
||||||
|
|
|
@ -162,7 +162,7 @@ public class JingleContent implements ExtensionElement {
|
||||||
|
|
||||||
synchronized (transports) {
|
synchronized (transports) {
|
||||||
|
|
||||||
buf.append("<").append(getElementName());
|
buf.append('<').append(getElementName());
|
||||||
|
|
||||||
buf.append(" creator='" + creator + "' name='" + name + "'>");
|
buf.append(" creator='" + creator + "' name='" + name + "'>");
|
||||||
|
|
||||||
|
@ -175,7 +175,7 @@ public class JingleContent implements ExtensionElement {
|
||||||
for (JingleTransport transport : transports) {
|
for (JingleTransport transport : transports) {
|
||||||
buf.append(transport.toXML());
|
buf.append(transport.toXML());
|
||||||
}
|
}
|
||||||
buf.append("</").append(getElementName()).append(">");
|
buf.append("</").append(getElementName()).append('>');
|
||||||
}
|
}
|
||||||
return buf.toString();
|
return buf.toString();
|
||||||
}
|
}
|
||||||
|
|
|
@ -149,7 +149,7 @@ public abstract class JingleContentDescription implements ExtensionElement {
|
||||||
|
|
||||||
synchronized (payloads) {
|
synchronized (payloads) {
|
||||||
if (payloads.size() > 0) {
|
if (payloads.size() > 0) {
|
||||||
buf.append("<").append(getElementName());
|
buf.append('<').append(getElementName());
|
||||||
buf.append(" xmlns=\"").append(getNamespace()).append("\" >");
|
buf.append(" xmlns=\"").append(getNamespace()).append("\" >");
|
||||||
|
|
||||||
Iterator<JinglePayloadType> pt = payloads.listIterator();
|
Iterator<JinglePayloadType> pt = payloads.listIterator();
|
||||||
|
@ -157,7 +157,7 @@ public abstract class JingleContentDescription implements ExtensionElement {
|
||||||
JinglePayloadType pte = pt.next();
|
JinglePayloadType pte = pt.next();
|
||||||
buf.append(pte.toXML());
|
buf.append(pte.toXML());
|
||||||
}
|
}
|
||||||
buf.append("</").append(getElementName()).append(">");
|
buf.append("</").append(getElementName()).append('>');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -251,17 +251,17 @@ public abstract class JingleContentDescription implements ExtensionElement {
|
||||||
StringBuilder buf = new StringBuilder();
|
StringBuilder buf = new StringBuilder();
|
||||||
|
|
||||||
if (payload != null) {
|
if (payload != null) {
|
||||||
buf.append("<").append(getElementName()).append(" ");
|
buf.append('<').append(getElementName()).append(' ');
|
||||||
|
|
||||||
// We covert here the payload type to XML
|
// We covert here the payload type to XML
|
||||||
if (payload.getId() != PayloadType.INVALID_PT) {
|
if (payload.getId() != PayloadType.INVALID_PT) {
|
||||||
buf.append(" id=\"").append(payload.getId()).append("\"");
|
buf.append(" id=\"").append(payload.getId()).append('"');
|
||||||
}
|
}
|
||||||
if (payload.getName() != null) {
|
if (payload.getName() != null) {
|
||||||
buf.append(" name=\"").append(payload.getName()).append("\"");
|
buf.append(" name=\"").append(payload.getName()).append('"');
|
||||||
}
|
}
|
||||||
if (payload.getChannels() != 0) {
|
if (payload.getChannels() != 0) {
|
||||||
buf.append(" channels=\"").append(payload.getChannels()).append("\"");
|
buf.append(" channels=\"").append(payload.getChannels()).append('"');
|
||||||
}
|
}
|
||||||
if (getChildAttributes() != null) {
|
if (getChildAttributes() != null) {
|
||||||
buf.append(getChildAttributes());
|
buf.append(getChildAttributes());
|
||||||
|
|
|
@ -82,7 +82,7 @@ public class JingleContentInfo implements ExtensionElement {
|
||||||
|
|
||||||
public String toXML() {
|
public String toXML() {
|
||||||
StringBuilder buf = new StringBuilder();
|
StringBuilder buf = new StringBuilder();
|
||||||
buf.append("<").append(getElementName()).append(" xmlns=\"");
|
buf.append('<').append(getElementName()).append(" xmlns=\"");
|
||||||
buf.append(getNamespace()).append("\" ");
|
buf.append(getNamespace()).append("\" ");
|
||||||
buf.append("/>");
|
buf.append("/>");
|
||||||
return buf.toString();
|
return buf.toString();
|
||||||
|
|
|
@ -156,7 +156,7 @@ public abstract class JingleDescription implements ExtensionElement {
|
||||||
|
|
||||||
synchronized (payloads) {
|
synchronized (payloads) {
|
||||||
if (payloads.size() > 0) {
|
if (payloads.size() > 0) {
|
||||||
buf.append("<").append(getElementName());
|
buf.append('<').append(getElementName());
|
||||||
buf.append(" xmlns=\"").append(getNamespace()).append("\" >");
|
buf.append(" xmlns=\"").append(getNamespace()).append("\" >");
|
||||||
|
|
||||||
for (PayloadType payloadType : payloads) {
|
for (PayloadType payloadType : payloads) {
|
||||||
|
@ -164,7 +164,7 @@ public abstract class JingleDescription implements ExtensionElement {
|
||||||
buf.append(payloadType.toXML());
|
buf.append(payloadType.toXML());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
buf.append("</").append(getElementName()).append(">");
|
buf.append("</").append(getElementName()).append('>');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -77,7 +77,7 @@ public class JingleError implements ExtensionElement {
|
||||||
StringBuilder buf = new StringBuilder();
|
StringBuilder buf = new StringBuilder();
|
||||||
if (message != null) {
|
if (message != null) {
|
||||||
buf.append("<error type=\"cancel\">");
|
buf.append("<error type=\"cancel\">");
|
||||||
buf.append("<").append(message).append(" xmlns=\"").append(NAMESPACE).append(
|
buf.append('<').append(message).append(" xmlns=\"").append(NAMESPACE).append(
|
||||||
"\"/>");
|
"\"/>");
|
||||||
buf.append("</error>");
|
buf.append("</error>");
|
||||||
}
|
}
|
||||||
|
|
|
@ -151,19 +151,19 @@ public class JingleTransport implements ExtensionElement {
|
||||||
public String toXML() {
|
public String toXML() {
|
||||||
StringBuilder buf = new StringBuilder();
|
StringBuilder buf = new StringBuilder();
|
||||||
|
|
||||||
buf.append("<").append(getElementName()).append(" xmlns=\"");
|
buf.append('<').append(getElementName()).append(" xmlns=\"");
|
||||||
buf.append(getNamespace()).append("\" ");
|
buf.append(getNamespace()).append("\" ");
|
||||||
|
|
||||||
synchronized (candidates) {
|
synchronized (candidates) {
|
||||||
if (getCandidatesCount() > 0) {
|
if (getCandidatesCount() > 0) {
|
||||||
buf.append(">");
|
buf.append('>');
|
||||||
Iterator<JingleTransportCandidate> iter = getCandidates();
|
Iterator<JingleTransportCandidate> iter = getCandidates();
|
||||||
|
|
||||||
while (iter.hasNext()) {
|
while (iter.hasNext()) {
|
||||||
JingleTransportCandidate candidate = iter.next();
|
JingleTransportCandidate candidate = iter.next();
|
||||||
buf.append(candidate.toXML());
|
buf.append(candidate.toXML());
|
||||||
}
|
}
|
||||||
buf.append("</").append(getElementName()).append(">");
|
buf.append("</").append(getElementName()).append('>');
|
||||||
} else {
|
} else {
|
||||||
buf.append("/>");
|
buf.append("/>");
|
||||||
}
|
}
|
||||||
|
@ -251,7 +251,7 @@ public class JingleTransport implements ExtensionElement {
|
||||||
String childElements = getChildElements();
|
String childElements = getChildElements();
|
||||||
|
|
||||||
if (transportCandidate != null && childElements != null) {
|
if (transportCandidate != null && childElements != null) {
|
||||||
buf.append("<").append(getElementName()).append(" ");
|
buf.append('<').append(getElementName()).append(' ');
|
||||||
buf.append(childElements);
|
buf.append(childElements);
|
||||||
buf.append("/>");
|
buf.append("/>");
|
||||||
}
|
}
|
||||||
|
@ -323,18 +323,18 @@ public class JingleTransport implements ExtensionElement {
|
||||||
ICECandidate tci = (ICECandidate) transportCandidate;
|
ICECandidate tci = (ICECandidate) transportCandidate;
|
||||||
|
|
||||||
// We convert the transportElement candidate to XML here...
|
// We convert the transportElement candidate to XML here...
|
||||||
buf.append(" generation=\"").append(tci.getGeneration()).append("\"");
|
buf.append(" generation=\"").append(tci.getGeneration()).append('"');
|
||||||
buf.append(" ip=\"").append(tci.getIp()).append("\"");
|
buf.append(" ip=\"").append(tci.getIp()).append('"');
|
||||||
buf.append(" port=\"").append(tci.getPort()).append("\"");
|
buf.append(" port=\"").append(tci.getPort()).append('"');
|
||||||
buf.append(" network=\"").append(tci.getNetwork()).append("\"");
|
buf.append(" network=\"").append(tci.getNetwork()).append('"');
|
||||||
buf.append(" username=\"").append(tci.getUsername()).append("\"");
|
buf.append(" username=\"").append(tci.getUsername()).append('"');
|
||||||
buf.append(" password=\"").append(tci.getPassword()).append("\"");
|
buf.append(" password=\"").append(tci.getPassword()).append('"');
|
||||||
buf.append(" preference=\"").append(tci.getPreference()).append("\"");
|
buf.append(" preference=\"").append(tci.getPreference()).append('"');
|
||||||
buf.append(" type=\"").append(tci.getType()).append("\"");
|
buf.append(" type=\"").append(tci.getType()).append('"');
|
||||||
|
|
||||||
// Optional elements
|
// Optional elements
|
||||||
if (transportCandidate.getName() != null) {
|
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) {
|
if (transportCandidate != null && transportCandidate instanceof TransportCandidate.Fixed) {
|
||||||
TransportCandidate.Fixed tcf = (TransportCandidate.Fixed) transportCandidate;
|
TransportCandidate.Fixed tcf = (TransportCandidate.Fixed) transportCandidate;
|
||||||
|
|
||||||
buf.append(" generation=\"").append(tcf.getGeneration()).append("\"");
|
buf.append(" generation=\"").append(tcf.getGeneration()).append('"');
|
||||||
buf.append(" ip=\"").append(tcf.getIp()).append("\"");
|
buf.append(" ip=\"").append(tcf.getIp()).append('"');
|
||||||
buf.append(" port=\"").append(tcf.getPort()).append("\"");
|
buf.append(" port=\"").append(tcf.getPort()).append('"');
|
||||||
|
|
||||||
// Optional parameters
|
// Optional parameters
|
||||||
String name = tcf.getName();
|
String name = tcf.getName();
|
||||||
if (name != null) {
|
if (name != null) {
|
||||||
buf.append(" name=\"").append(name).append("\"");
|
buf.append(" name=\"").append(name).append('"');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return buf.toString();
|
return buf.toString();
|
||||||
|
|
|
@ -91,11 +91,11 @@ public class AgentStatus implements ExtensionElement {
|
||||||
public String toXML() {
|
public String toXML() {
|
||||||
StringBuilder buf = new StringBuilder();
|
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) {
|
if (workgroupJID != null) {
|
||||||
buf.append(" jid=\"").append(workgroupJID).append("\"");
|
buf.append(" jid=\"").append(workgroupJID).append('"');
|
||||||
}
|
}
|
||||||
buf.append(">");
|
buf.append('>');
|
||||||
if (maxChats != -1) {
|
if (maxChats != -1) {
|
||||||
buf.append("<max-chats>").append(maxChats).append("</max-chats>");
|
buf.append("<max-chats>").append(maxChats).append("</max-chats>");
|
||||||
}
|
}
|
||||||
|
@ -197,22 +197,22 @@ public class AgentStatus implements ExtensionElement {
|
||||||
|
|
||||||
buf.append("<chat ");
|
buf.append("<chat ");
|
||||||
if (sessionID != null) {
|
if (sessionID != null) {
|
||||||
buf.append(" sessionID=\"").append(sessionID).append("\"");
|
buf.append(" sessionID=\"").append(sessionID).append('"');
|
||||||
}
|
}
|
||||||
if (userID != null) {
|
if (userID != null) {
|
||||||
buf.append(" userID=\"").append(userID).append("\"");
|
buf.append(" userID=\"").append(userID).append('"');
|
||||||
}
|
}
|
||||||
if (date != null) {
|
if (date != null) {
|
||||||
buf.append(" startTime=\"").append(UTC_FORMAT.format(date)).append("\"");
|
buf.append(" startTime=\"").append(UTC_FORMAT.format(date)).append('"');
|
||||||
}
|
}
|
||||||
if (email != null) {
|
if (email != null) {
|
||||||
buf.append(" email=\"").append(email).append("\"");
|
buf.append(" email=\"").append(email).append('"');
|
||||||
}
|
}
|
||||||
if (username != null) {
|
if (username != null) {
|
||||||
buf.append(" username=\"").append(username).append("\"");
|
buf.append(" username=\"").append(username).append('"');
|
||||||
}
|
}
|
||||||
if (question != null) {
|
if (question != null) {
|
||||||
buf.append(" question=\"").append(question).append("\"");
|
buf.append(" question=\"").append(question).append('"');
|
||||||
}
|
}
|
||||||
buf.append("/>");
|
buf.append("/>");
|
||||||
|
|
||||||
|
|
|
@ -108,7 +108,7 @@ public final class QueueDetails implements ExtensionElement {
|
||||||
|
|
||||||
public String toXML() {
|
public String toXML() {
|
||||||
StringBuilder buf = new StringBuilder();
|
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) {
|
synchronized (users) {
|
||||||
for (Iterator<QueueUser> i=users.iterator(); i.hasNext(); ) {
|
for (Iterator<QueueUser> i=users.iterator(); i.hasNext(); ) {
|
||||||
|
@ -136,7 +136,7 @@ public final class QueueDetails implements ExtensionElement {
|
||||||
buf.append("</user>");
|
buf.append("</user>");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
buf.append("</").append(ELEMENT_NAME).append(">");
|
buf.append("</").append(ELEMENT_NAME).append('>');
|
||||||
return buf.toString();
|
return buf.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -98,7 +98,7 @@ public class QueueOverview implements ExtensionElement {
|
||||||
|
|
||||||
public String toXML () {
|
public String toXML () {
|
||||||
StringBuilder buf = new StringBuilder();
|
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) {
|
if (userCount != -1) {
|
||||||
buf.append("<count>").append(userCount).append("</count>");
|
buf.append("<count>").append(userCount).append("</count>");
|
||||||
|
@ -112,7 +112,7 @@ public class QueueOverview implements ExtensionElement {
|
||||||
if (status != null) {
|
if (status != null) {
|
||||||
buf.append("<status>").append(status).append("</status>");
|
buf.append("<status>").append(status).append("</status>");
|
||||||
}
|
}
|
||||||
buf.append("</").append(ELEMENT_NAME).append(">");
|
buf.append("</").append(ELEMENT_NAME).append('>');
|
||||||
|
|
||||||
return buf.toString();
|
return buf.toString();
|
||||||
}
|
}
|
||||||
|
|
|
@ -57,7 +57,7 @@ public class SessionID implements ExtensionElement {
|
||||||
public String toXML() {
|
public String toXML() {
|
||||||
StringBuilder buf = new StringBuilder();
|
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("id=\"").append(this.getSessionID());
|
||||||
buf.append("\"/>");
|
buf.append("\"/>");
|
||||||
|
|
||||||
|
|
|
@ -59,7 +59,7 @@ public class UserID implements ExtensionElement {
|
||||||
public String toXML() {
|
public String toXML() {
|
||||||
StringBuilder buf = new StringBuilder();
|
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("id=\"").append(this.getUserID());
|
||||||
buf.append("\"/>");
|
buf.append("\"/>");
|
||||||
|
|
||||||
|
|
|
@ -62,7 +62,7 @@ public class WorkgroupInformation implements ExtensionElement {
|
||||||
StringBuilder buf = new StringBuilder();
|
StringBuilder buf = new StringBuilder();
|
||||||
|
|
||||||
buf.append('<').append(ELEMENT_NAME);
|
buf.append('<').append(ELEMENT_NAME);
|
||||||
buf.append(" jid=\"").append(getWorkgroupJID()).append("\"");
|
buf.append(" jid=\"").append(getWorkgroupJID()).append('"');
|
||||||
buf.append(" xmlns=\"").append(NAMESPACE).append("\" />");
|
buf.append(" xmlns=\"").append(NAMESPACE).append("\" />");
|
||||||
|
|
||||||
return buf.toString();
|
return buf.toString();
|
||||||
|
|
|
@ -66,7 +66,7 @@ public class GenericSettings extends IQ {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected IQChildElementXmlStringBuilder getIQChildElementBuilder(IQChildElementXmlStringBuilder buf) {
|
protected IQChildElementXmlStringBuilder getIQChildElementBuilder(IQChildElementXmlStringBuilder buf) {
|
||||||
buf.append(">");
|
buf.append('>');
|
||||||
if (ModelUtil.hasLength(getQuery())) {
|
if (ModelUtil.hasLength(getQuery())) {
|
||||||
buf.append("<query>" + getQuery() + "</query>");
|
buf.append("<query>" + getQuery() + "</query>");
|
||||||
}
|
}
|
||||||
|
|
|
@ -305,30 +305,30 @@ public class MessageEvent implements ExtensionElement {
|
||||||
*/
|
*/
|
||||||
public String toXML() {
|
public String toXML() {
|
||||||
StringBuilder buf = new StringBuilder();
|
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
|
// 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
|
// Add the offline tag if the sender requests to be notified of offline events or if
|
||||||
// the target is offline
|
// the target is offline
|
||||||
if (isOffline())
|
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
|
// 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
|
// delivered or if the target notifies that the message has been delivered
|
||||||
if (isDelivered())
|
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
|
// 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
|
// displayed or if the target notifies that the message has been displayed
|
||||||
if (isDisplayed())
|
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
|
// 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
|
// composing a reply or if the target notifies that he/she is composing a reply
|
||||||
if (isComposing())
|
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)
|
// Add the id tag only if the MessageEvent is a notification message (not a request)
|
||||||
if (getStanzaId() != null)
|
if (getStanzaId() != null)
|
||||||
buf.append("<id>").append(getStanzaId()).append("</id>");
|
buf.append("<id>").append(getStanzaId()).append("</id>");
|
||||||
buf.append("</").append(getElementName()).append(">");
|
buf.append("</").append(getElementName()).append('>');
|
||||||
return buf.toString();
|
return buf.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -100,11 +100,11 @@ public class RemoteRosterEntry {
|
||||||
|
|
||||||
public String toXML() {
|
public String toXML() {
|
||||||
StringBuilder buf = new StringBuilder();
|
StringBuilder buf = new StringBuilder();
|
||||||
buf.append("<item jid=\"").append(user).append("\"");
|
buf.append("<item jid=\"").append(user).append('"');
|
||||||
if (name != null) {
|
if (name != null) {
|
||||||
buf.append(" name=\"").append(name).append("\"");
|
buf.append(" name=\"").append(name).append('"');
|
||||||
}
|
}
|
||||||
buf.append(">");
|
buf.append('>');
|
||||||
synchronized (groupNames) {
|
synchronized (groupNames) {
|
||||||
for (String groupName : groupNames) {
|
for (String groupName : groupNames) {
|
||||||
buf.append("<group>").append(groupName).append("</group>");
|
buf.append("<group>").append(groupName).append("</group>");
|
||||||
|
|
|
@ -165,14 +165,14 @@ public class RosterExchange implements ExtensionElement {
|
||||||
*/
|
*/
|
||||||
public String toXML() {
|
public String toXML() {
|
||||||
StringBuilder buf = new StringBuilder();
|
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
|
// Loop through all roster entries and append them to the string buffer
|
||||||
for (Iterator<RemoteRosterEntry> i = getRosterEntries(); i.hasNext();) {
|
for (Iterator<RemoteRosterEntry> i = getRosterEntries(); i.hasNext();) {
|
||||||
RemoteRosterEntry remoteRosterEntry = i.next();
|
RemoteRosterEntry remoteRosterEntry = i.next();
|
||||||
buf.append(remoteRosterEntry.toXML());
|
buf.append(remoteRosterEntry.toXML());
|
||||||
}
|
}
|
||||||
buf.append("</").append(getElementName()).append(">");
|
buf.append("</").append(getElementName()).append('>');
|
||||||
return buf.toString();
|
return buf.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue