1
0
Fork 0
mirror of https://github.com/vanitasvitae/Smack.git synced 2025-09-09 00:59:39 +02:00

Remove all tabs and add checkstyle rule that enforces no-tabs

Fixes SMACK-866.
This commit is contained in:
Florian Schmaus 2019-05-07 21:24:00 +02:00
parent 575364cc1f
commit 68d7d738b6
10 changed files with 104 additions and 158 deletions

View file

@ -113,31 +113,28 @@ public class MacroGroup {
}
public String toXML() {
// CHECKSTYLE:OFF
StringBuilder buf = new StringBuilder();
buf.append("<macrogroup>");
buf.append("<title>" + getTitle() + "</title>");
buf.append("<macros>");
for (Macro macro : getMacros())
{
buf.append("<macro>");
buf.append("<title>" + macro.getTitle() + "</title>");
buf.append("<type>" + macro.getType() + "</type>");
buf.append("<description>" + macro.getDescription() + "</description>");
buf.append("<response>" + macro.getResponse() + "</response>");
buf.append("</macro>");
}
buf.append("</macros>");
StringBuilder buf = new StringBuilder();
buf.append("<macrogroup>");
buf.append("<title>" + getTitle() + "</title>");
buf.append("<macros>");
for (Macro macro : getMacros()) {
buf.append("<macro>");
buf.append("<title>" + macro.getTitle() + "</title>");
buf.append("<type>" + macro.getType() + "</type>");
buf.append("<description>" + macro.getDescription() + "</description>");
buf.append("<response>" + macro.getResponse() + "</response>");
buf.append("</macro>");
}
buf.append("</macros>");
if (getMacroGroups().size() > 0) {
buf.append("<macroGroups>");
for (MacroGroup groups : getMacroGroups()) {
buf.append(groups.toXML());
}
buf.append("</macroGroups>");
}
buf.append("</macrogroup>");
return buf.toString();
// CHECKSTYLE:ON
if (getMacroGroups().size() > 0) {
buf.append("<macroGroups>");
for (MacroGroup groups : getMacroGroups()) {
buf.append(groups.toXML());
}
buf.append("</macroGroups>");
}
buf.append("</macrogroup>");
return buf.toString();
}
}

View file

@ -83,11 +83,9 @@ public class Macros extends IQ {
buf.append("<personal>true</personal>");
}
if (getPersonalMacroGroup() != null) {
// CHECKSTYLE:OFF
buf.append("<personalMacro>");
buf.append(StringUtils.escapeForXmlText(getPersonalMacroGroup().toXML()));
buf.append("</personalMacro>");
// CHECKSTYLE:ON
buf.append("<personalMacro>");
buf.append(StringUtils.escapeForXmlText(getPersonalMacroGroup().toXML()));
buf.append("</personalMacro>");
}
return buf;

View file

@ -478,17 +478,13 @@ public class Workgroup {
private void fireInvitationEvent(WorkgroupInvitation invitation) {
for (WorkgroupInvitationListener listener : invitationListeners) {
// CHECKSTYLE:OFF
listener.invitationReceived(invitation);
// CHECKSTYLE:ON
listener.invitationReceived(invitation);
}
}
private void fireQueueJoinedEvent() {
for (QueueListener listener : queueListeners) {
// CHECKSTYLE:OFF
listener.joinedQueue();
// CHECKSTYLE:ON
listener.joinedQueue();
}
}

View file

@ -50,30 +50,29 @@ public class RosterExchangeProvider extends ExtensionElementProvider<RosterExcha
@Override
public RosterExchange parse(XmlPullParser parser, int initialDepth, XmlEnvironment xmlEnvironment)
throws XmlPullParserException, IOException {
// CHECKSTYLE:OFF
RosterExchange rosterExchange = new RosterExchange();
boolean done = false;
RemoteRosterEntry remoteRosterEntry;
Jid jid = null;
String name = "";
ArrayList<String> groupsName = new ArrayList<>();
String name = "";
ArrayList<String> groupsName = new ArrayList<>();
while (!done) {
XmlPullParser.Event eventType = parser.next();
if (eventType == XmlPullParser.Event.START_ELEMENT) {
if (parser.getName().equals("item")) {
// Reset this variable since they are optional for each item
groupsName = new ArrayList<>();
// Initialize the variables from the parsed XML
// Reset this variable since they are optional for each item
groupsName = new ArrayList<>();
// Initialize the variables from the parsed XML
jid = ParserUtils.getJidAttribute(parser);
name = parser.getAttributeValue("", "name");
}
if (parser.getName().equals("group")) {
groupsName.add(parser.nextText());
groupsName.add(parser.nextText());
}
} else if (eventType == XmlPullParser.Event.END_ELEMENT) {
if (parser.getName().equals("item")) {
// Create packet.
remoteRosterEntry = new RemoteRosterEntry(jid, name, groupsName.toArray(new String[groupsName.size()]));
// Create packet.
remoteRosterEntry = new RemoteRosterEntry(jid, name, groupsName.toArray(new String[groupsName.size()]));
rosterExchange.addRosterEntry(remoteRosterEntry);
}
if (parser.getName().equals("x")) {
@ -81,7 +80,6 @@ public class RosterExchangeProvider extends ExtensionElementProvider<RosterExcha
}
}
}
// CHECKSTYLE:ON
return rosterExchange;
}