From 4c13ea4125fcca3f184ff0404cc3a827aae25dae Mon Sep 17 00:00:00 2001 From: Florian Schmaus Date: Wed, 28 Mar 2018 14:47:33 +0200 Subject: [PATCH] Fix style issues in Workgroup Macros --- .../smackx/workgroup/ext/macros/Macros.java | 118 +++++++++--------- 1 file changed, 56 insertions(+), 62 deletions(-) diff --git a/smack-legacy/src/main/java/org/jivesoftware/smackx/workgroup/ext/macros/Macros.java b/smack-legacy/src/main/java/org/jivesoftware/smackx/workgroup/ext/macros/Macros.java index ce7670e36..8a1a31ae4 100644 --- a/smack-legacy/src/main/java/org/jivesoftware/smackx/workgroup/ext/macros/Macros.java +++ b/smack-legacy/src/main/java/org/jivesoftware/smackx/workgroup/ext/macros/Macros.java @@ -126,80 +126,74 @@ public class Macros extends IQ { } public Macro parseMacro(XmlPullParser parser) throws XmlPullParserException, IOException { - // CHECKSTYLE:OFF - Macro macro = new Macro(); - boolean done = false; + Macro macro = new Macro(); + boolean done = false; while (!done) { - int eventType = parser.next(); - if (eventType == XmlPullParser.START_TAG) { - if (parser.getName().equals("title")) { - parser.next(); - macro.setTitle(parser.getText()); - } - else if (parser.getName().equals("description")) { - macro.setDescription(parser.nextText()); - } - else if (parser.getName().equals("response")) { - macro.setResponse(parser.nextText()); - } - else if (parser.getName().equals("type")) { - macro.setType(Integer.valueOf(parser.nextText()).intValue()); - } - } - else if (eventType == XmlPullParser.END_TAG) { - if (parser.getName().equals("macro")) { - done = true; - } - } + int eventType = parser.next(); + if (eventType == XmlPullParser.START_TAG) { + if (parser.getName().equals("title")) { + parser.next(); + macro.setTitle(parser.getText()); + } + else if (parser.getName().equals("description")) { + macro.setDescription(parser.nextText()); + } + else if (parser.getName().equals("response")) { + macro.setResponse(parser.nextText()); + } + else if (parser.getName().equals("type")) { + macro.setType(Integer.valueOf(parser.nextText()).intValue()); + } + } + else if (eventType == XmlPullParser.END_TAG) { + if (parser.getName().equals("macro")) { + done = true; + } + } } - return macro; - // CHECKSTYLE:ON + return macro; } public MacroGroup parseMacroGroup(XmlPullParser parser) throws XmlPullParserException, IOException { - // CHECKSTYLE:OFF - MacroGroup group = new MacroGroup(); + MacroGroup group = new MacroGroup(); boolean done = false; while (!done) { - int eventType = parser.next(); - if (eventType == XmlPullParser.START_TAG) { - if (parser.getName().equals("macrogroup")) { - group.addMacroGroup(parseMacroGroup(parser)); - } - if (parser.getName().equals("title")) { - group.setTitle(parser.nextText()); - } - if (parser.getName().equals("macro")) { - group.addMacro(parseMacro(parser)); - } - } - else if (eventType == XmlPullParser.END_TAG) { - if (parser.getName().equals("macrogroup")) { - done = true; - } - } + int eventType = parser.next(); + if (eventType == XmlPullParser.START_TAG) { + if (parser.getName().equals("macrogroup")) { + group.addMacroGroup(parseMacroGroup(parser)); + } + if (parser.getName().equals("title")) { + group.setTitle(parser.nextText()); + } + if (parser.getName().equals("macro")) { + group.addMacro(parseMacro(parser)); + } + } + else if (eventType == XmlPullParser.END_TAG) { + if (parser.getName().equals("macrogroup")) { + done = true; + } + } } - return group; - // CHECKSTYLE:ON + return group; } public MacroGroup parseMacroGroups(String macros) throws XmlPullParserException, IOException { - // CHECKSTYLE:OFF - MacroGroup group = null; - XmlPullParser parser = XmlPullParserFactory.newInstance().newPullParser(); - parser.setInput(new StringReader(macros)); - int eventType = parser.getEventType(); - while (eventType != XmlPullParser.END_DOCUMENT) { - eventType = parser.next(); - if (eventType == XmlPullParser.START_TAG) { - if (parser.getName().equals("macrogroup")) { - group = parseMacroGroup(parser); - } - } - } - return group; - // CHECKSTYLE:ON + MacroGroup group = null; + XmlPullParser parser = XmlPullParserFactory.newInstance().newPullParser(); + parser.setInput(new StringReader(macros)); + int eventType = parser.getEventType(); + while (eventType != XmlPullParser.END_DOCUMENT) { + eventType = parser.next(); + if (eventType == XmlPullParser.START_TAG) { + if (parser.getName().equals("macrogroup")) { + group = parseMacroGroup(parser); + } + } + } + return group; } } }