正在查看: Housing v14.7.8 应用的 PacketParserUtils.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
正在查看: Housing v14.7.8 应用的 PacketParserUtils.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
package org.jivesoftware.smack.util;
import java.io.IOException;
import java.io.Reader;
import java.io.StringReader;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.LinkedList;
import java.util.Map;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.jivesoftware.smack.SmackException;
import org.jivesoftware.smack.compress.packet.Compress;
import org.jivesoftware.smack.packet.DefaultExtensionElement;
import org.jivesoftware.smack.packet.EmptyResultIQ;
import org.jivesoftware.smack.packet.ErrorIQ;
import org.jivesoftware.smack.packet.ExtensionElement;
import org.jivesoftware.smack.packet.IQ;
import org.jivesoftware.smack.packet.Mechanisms;
import org.jivesoftware.smack.packet.Message;
import org.jivesoftware.smack.packet.Presence;
import org.jivesoftware.smack.packet.Session;
import org.jivesoftware.smack.packet.Stanza;
import org.jivesoftware.smack.packet.StartTls;
import org.jivesoftware.smack.packet.StreamError;
import org.jivesoftware.smack.packet.UnparsedIQ;
import org.jivesoftware.smack.packet.XMPPError;
import org.jivesoftware.smack.provider.ExtensionElementProvider;
import org.jivesoftware.smack.provider.IQProvider;
import org.jivesoftware.smack.provider.ProviderManager;
import org.jivesoftware.smack.sasl.packet.SaslStreamElements;
import org.jivesoftware.smackx.privacy.packet.PrivacyItem;
import org.xmlpull.v1.XmlPullParser;
import org.xmlpull.v1.XmlPullParserException;
import org.xmlpull.v1.XmlPullParserFactory;
public class PacketParserUtils {
static final boolean $assertionsDisabled = false;
public static final String FEATURE_XML_ROUNDTRIP = "http://xmlpull.org/v1/doc/features.html#xml-roundtrip";
private static final Logger LOGGER = Logger.getLogger(PacketParserUtils.class.getName());
private static final XmlPullParserFactory XML_PULL_PARSER_FACTORY;
public static final boolean XML_PULL_PARSER_SUPPORTS_ROUNDTRIP;
public static class AnonymousClass1 {
static final int[] $SwitchMap$org$jivesoftware$smack$packet$IQ$Type;
static {
int[] iArr = new int[IQ.Type.values().length];
$SwitchMap$org$jivesoftware$smack$packet$IQ$Type = iArr;
try {
iArr[IQ.Type.error.ordinal()] = 1;
} catch (NoSuchFieldError unused) {
}
try {
$SwitchMap$org$jivesoftware$smack$packet$IQ$Type[IQ.Type.result.ordinal()] = 2;
} catch (NoSuchFieldError unused2) {
}
}
}
static {
boolean z;
try {
XmlPullParserFactory newInstance = XmlPullParserFactory.newInstance();
XML_PULL_PARSER_FACTORY = newInstance;
try {
z = true;
newInstance.newPullParser().setFeature(FEATURE_XML_ROUNDTRIP, true);
} catch (XmlPullParserException e) {
LOGGER.log(Level.FINEST, "XmlPullParser does not support XML_ROUNDTRIP", (Throwable) e);
z = false;
}
XML_PULL_PARSER_SUPPORTS_ROUNDTRIP = z;
} catch (XmlPullParserException e2) {
throw new AssertionError(e2);
}
}
public static void addExtensionElement(Collection<ExtensionElement> collection, XmlPullParser xmlPullParser) throws XmlPullParserException, IOException, SmackException {
addExtensionElement(collection, xmlPullParser, xmlPullParser.getName(), xmlPullParser.getNamespace());
}
@Deprecated
public static void addPacketExtension(Collection<ExtensionElement> collection, XmlPullParser xmlPullParser) throws XmlPullParserException, IOException, SmackException {
addExtensionElement(collection, xmlPullParser, xmlPullParser.getName(), xmlPullParser.getNamespace());
}
private static String getLanguageAttribute(XmlPullParser xmlPullParser) {
for (int i = 0; i < xmlPullParser.getAttributeCount(); i++) {
String attributeName = xmlPullParser.getAttributeName(i);
if ("xml:lang".equals(attributeName) || ("lang".equals(attributeName) && "xml".equals(xmlPullParser.getAttributePrefix(i)))) {
return xmlPullParser.getAttributeValue(i);
}
}
return null;
}
public static XmlPullParser getParserFor(Reader reader) throws XmlPullParserException, IOException {
XmlPullParser newXmppParser = newXmppParser(reader);
for (int eventType = newXmppParser.getEventType(); eventType != 2; eventType = newXmppParser.next()) {
if (eventType == 1) {
throw new IllegalArgumentException("Document contains no start tag");
}
}
return newXmppParser;
}
public static XmlPullParser newXmppParser() throws XmlPullParserException {
XmlPullParser newPullParser = XmlPullParserFactory.newInstance().newPullParser();
newPullParser.setFeature("http://xmlpull.org/v1/doc/features.html#process-namespaces", true);
if (XML_PULL_PARSER_SUPPORTS_ROUNDTRIP) {
try {
newPullParser.setFeature(FEATURE_XML_ROUNDTRIP, true);
return newPullParser;
} catch (XmlPullParserException e) {
LOGGER.log(Level.SEVERE, "XmlPullParser does not support XML_ROUNDTRIP, although it was first determined to be supported", (Throwable) e);
}
}
return newPullParser;
}
public static Compress.Feature parseCompressionFeature(XmlPullParser xmlPullParser) throws IOException, XmlPullParserException {
int depth = xmlPullParser.getDepth();
LinkedList linkedList = new LinkedList();
while (true) {
int next = xmlPullParser.next();
if (next == 2) {
String name = xmlPullParser.getName();
name.getClass();
if (name.equals("method")) {
linkedList.add(xmlPullParser.nextText());
}
} else if (next != 3) {
continue;
} else {
String name2 = xmlPullParser.getName();
name2.getClass();
if (name2.equals(Compress.Feature.ELEMENT) && xmlPullParser.getDepth() == depth) {
return new Compress.Feature(linkedList);
}
}
}
}
public static CharSequence parseContent(XmlPullParser xmlPullParser) throws XmlPullParserException, IOException {
if (xmlPullParser.isEmptyElementTag()) {
return "";
}
xmlPullParser.next();
return parseContentDepth(xmlPullParser, xmlPullParser.getDepth(), false);
}
public static CharSequence parseContentDepth(XmlPullParser xmlPullParser, int i) throws XmlPullParserException, IOException {
return parseContentDepth(xmlPullParser, i, false);
}
private static CharSequence parseContentDepthWithRoundtrip(XmlPullParser xmlPullParser, int i, boolean z) throws XmlPullParserException, IOException {
StringBuilder sb = new StringBuilder();
int eventType = xmlPullParser.getEventType();
while (true) {
if (eventType != 2 || !xmlPullParser.isEmptyElementTag()) {
String text = xmlPullParser.getText();
String str = text;
if (eventType == 4) {
str = StringUtils.escapeForXML(text.toString());
}
sb.append((CharSequence) str);
}
if (eventType == 3 && xmlPullParser.getDepth() <= i) {
return sb;
}
eventType = xmlPullParser.next();
}
}
private static CharSequence parseContentDepthWithoutRoundtrip(XmlPullParser xmlPullParser, int i, boolean z) throws XmlPullParserException, IOException {
XmlStringBuilder xmlStringBuilder = new XmlStringBuilder();
int eventType = xmlPullParser.getEventType();
boolean z2 = false;
String str = null;
while (true) {
if (eventType == 2) {
xmlStringBuilder.halfOpenElement(xmlPullParser.getName());
if (str == null || z) {
String namespace = xmlPullParser.getNamespace();
if (StringUtils.isNotEmpty(namespace)) {
xmlStringBuilder.attribute("xmlns", namespace);
str = xmlPullParser.getName();
}
}
for (int i2 = 0; i2 < xmlPullParser.getAttributeCount(); i2++) {
xmlStringBuilder.attribute(xmlPullParser.getAttributeName(i2), xmlPullParser.getAttributeValue(i2));
}
if (xmlPullParser.isEmptyElementTag()) {
xmlStringBuilder.closeEmptyElement();
z2 = true;
} else {
xmlStringBuilder.rightAngleBracket();
}
} else if (eventType == 3) {
if (z2) {
z2 = false;
} else {
xmlStringBuilder.closeElement(xmlPullParser.getName());
}
if (str != null && str.equals(xmlPullParser.getName())) {
str = null;
}
if (xmlPullParser.getDepth() <= i) {
return xmlStringBuilder;
}
} else if (eventType == 4) {
xmlStringBuilder.escape(xmlPullParser.getText());
}
eventType = xmlPullParser.next();
}
}
public static Map<String, String> parseDescriptiveTexts(XmlPullParser xmlPullParser, Map<String, String> map) throws XmlPullParserException, IOException {
if (map == null) {
map = new HashMap<>();
}
map.put(getLanguageAttribute(xmlPullParser), xmlPullParser.nextText());
return map;
}
public static CharSequence parseElement(XmlPullParser xmlPullParser) throws XmlPullParserException, IOException {
return parseElement(xmlPullParser, false);
}
public static String parseElementText(XmlPullParser xmlPullParser) throws XmlPullParserException, IOException {
if (xmlPullParser.isEmptyElementTag()) {
return "";
}
int next = xmlPullParser.next();
if (next != 4) {
if (next == 3) {
return "";
}
throw new XmlPullParserException("Non-empty element tag not followed by text, while Mixed Content (XML 3.2.2) is disallowed");
}
String text = xmlPullParser.getText();
if (xmlPullParser.next() == 3) {
return text;
}
throw new XmlPullParserException("Non-empty element tag contains child-elements, while Mixed Content (XML 3.2.2) is disallowed");
}
public static XMPPError parseError(XmlPullParser xmlPullParser) throws XmlPullParserException, IOException, SmackException {
int depth = xmlPullParser.getDepth();
ArrayList arrayList = new ArrayList();
XMPPError.Type fromString = XMPPError.Type.fromString(xmlPullParser.getAttributeValue("", "type"));
String attributeValue = xmlPullParser.getAttributeValue("", "by");
XMPPError.Condition condition = null;
String str = null;
Map<String, String> map = null;
while (true) {
int next = xmlPullParser.next();
if (next == 2) {
String name = xmlPullParser.getName();
String namespace = xmlPullParser.getNamespace();
namespace.getClass();
if (namespace.equals(XMPPError.NAMESPACE)) {
name.getClass();
if (name.equals("text")) {
map = parseDescriptiveTexts(xmlPullParser, map);
} else {
condition = XMPPError.Condition.fromString(name);
if (!xmlPullParser.isEmptyElementTag()) {
str = xmlPullParser.nextText();
}
}
} else {
addExtensionElement(arrayList, xmlPullParser, name, namespace);
}
} else if (next == 3 && xmlPullParser.getDepth() == depth) {
return new XMPPError(condition, str, attributeValue, fromString, map, arrayList);
}
}
}
public static ExtensionElement parseExtensionElement(String str, String str2, XmlPullParser xmlPullParser) throws XmlPullParserException, IOException, SmackException {
String str3;
ParserUtils.assertAtStartTag(xmlPullParser);
ExtensionElementProvider<ExtensionElement> extensionProvider = ProviderManager.getExtensionProvider(str, str2);
if (extensionProvider != null) {
return (ExtensionElement) extensionProvider.parse(xmlPullParser);
}
int depth = xmlPullParser.getDepth();
DefaultExtensionElement defaultExtensionElement = new DefaultExtensionElement(str, str2);
while (true) {
int next = xmlPullParser.next();
if (next == 2) {
String name = xmlPullParser.getName();
if (xmlPullParser.isEmptyElementTag()) {
str3 = "";
} else if (xmlPullParser.next() == 4) {
str3 = xmlPullParser.getText();
}
defaultExtensionElement.setValue(name, str3);
} else if (next == 3 && xmlPullParser.getDepth() == depth) {
return defaultExtensionElement;
}
}
}
public static IQ parseIQ(XmlPullParser xmlPullParser) throws XmlPullParserException, IOException, SmackException {
ParserUtils.assertAtStartTag(xmlPullParser);
int depth = xmlPullParser.getDepth();
String attributeValue = xmlPullParser.getAttributeValue("", "id");
String attributeValue2 = xmlPullParser.getAttributeValue("", PrivacyItem.SUBSCRIPTION_TO);
String attributeValue3 = xmlPullParser.getAttributeValue("", PrivacyItem.SUBSCRIPTION_FROM);
IQ.Type fromString = IQ.Type.fromString(xmlPullParser.getAttributeValue("", "type"));
IQ iq2 = null;
XMPPError xMPPError = null;
while (true) {
int next = xmlPullParser.next();
if (next == 2) {
String name = xmlPullParser.getName();
String namespace = xmlPullParser.getNamespace();
name.getClass();
if (name.equals("error")) {
xMPPError = parseError(xmlPullParser);
} else {
IQProvider<IQ> iQProvider = ProviderManager.getIQProvider(name, namespace);
iq2 = iQProvider != null ? (IQ) iQProvider.parse(xmlPullParser) : new UnparsedIQ(name, namespace, parseElement(xmlPullParser));
}
} else if (next == 3 && xmlPullParser.getDepth() == depth) {
break;
}
}
if (iq2 == null) {
int i = AnonymousClass1.$SwitchMap$org$jivesoftware$smack$packet$IQ$Type[fromString.ordinal()];
if (i == 1) {
iq2 = new ErrorIQ(xMPPError);
} else if (i == 2) {
iq2 = new EmptyResultIQ();
}
}
iq2.setStanzaId(attributeValue);
iq2.setTo(attributeValue2);
iq2.setFrom(attributeValue3);
iq2.setType(fromString);
iq2.setError(xMPPError);
return iq2;
}
public static Collection<String> parseMechanisms(XmlPullParser xmlPullParser) throws XmlPullParserException, IOException {
ArrayList arrayList = new ArrayList();
boolean z = false;
while (!z) {
int next = xmlPullParser.next();
if (next == 2) {
if (xmlPullParser.getName().equals("mechanism")) {
arrayList.add(xmlPullParser.nextText());
}
} else if (next == 3 && xmlPullParser.getName().equals(Mechanisms.ELEMENT)) {
z = true;
}
}
return arrayList;
}
public static Message parseMessage(XmlPullParser xmlPullParser) throws XmlPullParserException, IOException, SmackException {
String name;
String namespace;
ParserUtils.assertAtStartTag(xmlPullParser);
int depth = xmlPullParser.getDepth();
Message message = new Message();
message.setStanzaId(xmlPullParser.getAttributeValue("", "id"));
message.setTo(xmlPullParser.getAttributeValue("", PrivacyItem.SUBSCRIPTION_TO));
message.setFrom(xmlPullParser.getAttributeValue("", PrivacyItem.SUBSCRIPTION_FROM));
String attributeValue = xmlPullParser.getAttributeValue("", "type");
if (attributeValue != null) {
message.setType(Message.Type.fromString(attributeValue));
}
String languageAttribute = getLanguageAttribute(xmlPullParser);
if (languageAttribute == null || "".equals(languageAttribute.trim())) {
languageAttribute = Stanza.getDefaultLanguage();
} else {
message.setLanguage(languageAttribute);
}
String str = null;
while (true) {
int next = xmlPullParser.next();
if (next == 2) {
name = xmlPullParser.getName();
namespace = xmlPullParser.getNamespace();
name.getClass();
switch (name) {
case "subject":
String languageAttribute2 = getLanguageAttribute(xmlPullParser);
if (languageAttribute2 == null) {
languageAttribute2 = languageAttribute;
}
String parseElementText = parseElementText(xmlPullParser);
if (message.getSubject(languageAttribute2) != null) {
break;
} else {
message.addSubject(languageAttribute2, parseElementText);
break;
}
case "thread":
if (str != null) {
break;
} else {
str = xmlPullParser.nextText();
break;
}
case "body":
String languageAttribute3 = getLanguageAttribute(xmlPullParser);
if (languageAttribute3 == null) {
languageAttribute3 = languageAttribute;
}
String parseElementText2 = parseElementText(xmlPullParser);
if (message.getBody(languageAttribute3) != null) {
break;
} else {
message.addBody(languageAttribute3, parseElementText2);
break;
}
case "error":
message.setError(parseError(xmlPullParser));
break;
default:
addExtensionElement(message, xmlPullParser, name, namespace);
break;
}
} else if (next == 3 && xmlPullParser.getDepth() == depth) {
message.setThread(str);
return message;
}
}
}
@Deprecated
public static ExtensionElement parsePacketExtension(String str, String str2, XmlPullParser xmlPullParser) throws XmlPullParserException, IOException, SmackException {
return parseExtensionElement(str, str2, xmlPullParser);
}
public static Presence parsePresence(XmlPullParser xmlPullParser) throws XmlPullParserException, IOException, SmackException {
String name;
String namespace;
ParserUtils.assertAtStartTag(xmlPullParser);
int depth = xmlPullParser.getDepth();
Presence.Type type = Presence.Type.available;
String attributeValue = xmlPullParser.getAttributeValue("", "type");
if (attributeValue != null && !attributeValue.equals("")) {
type = Presence.Type.fromString(attributeValue);
}
Presence presence = new Presence(type);
presence.setTo(xmlPullParser.getAttributeValue("", PrivacyItem.SUBSCRIPTION_TO));
presence.setFrom(xmlPullParser.getAttributeValue("", PrivacyItem.SUBSCRIPTION_FROM));
presence.setStanzaId(xmlPullParser.getAttributeValue("", "id"));
String languageAttribute = getLanguageAttribute(xmlPullParser);
if (languageAttribute != null && !"".equals(languageAttribute.trim())) {
presence.setLanguage(languageAttribute);
}
while (true) {
int next = xmlPullParser.next();
if (next == 2) {
name = xmlPullParser.getName();
namespace = xmlPullParser.getNamespace();
name.getClass();
switch (name) {
case "priority":
presence.setPriority(Integer.parseInt(xmlPullParser.nextText()));
break;
case "status":
presence.setStatus(xmlPullParser.nextText());
break;
case "show":
String nextText = xmlPullParser.nextText();
if (!StringUtils.isNotEmpty(nextText)) {
LOGGER.warning("Empty or null mode text in presence show element form " + presence.getFrom() + " with id '" + presence.getStanzaId() + "' which is invalid according to RFC6121 4.7.2.1");
break;
} else {
presence.setMode(Presence.Mode.fromString(nextText));
break;
}
case "error":
presence.setError(parseError(xmlPullParser));
break;
default:
try {
addExtensionElement(presence, xmlPullParser, name, namespace);
break;
} catch (Exception e) {
LOGGER.log(Level.WARNING, "Failed to parse extension packet in Presence packet. Attributes: from=" + presence.getFrom() + " id=" + presence.getStanzaId(), (Throwable) e);
break;
}
}
} else if (next == 3 && xmlPullParser.getDepth() == depth) {
return presence;
}
}
}
public static SaslStreamElements.SASLFailure parseSASLFailure(XmlPullParser xmlPullParser) throws XmlPullParserException, IOException {
int depth = xmlPullParser.getDepth();
Map<String, String> map = null;
String str = null;
while (true) {
int next = xmlPullParser.next();
if (next != 2) {
if (next == 3 && xmlPullParser.getDepth() == depth) {
return new SaslStreamElements.SASLFailure(str, map);
}
} else if (xmlPullParser.getName().equals("text")) {
map = parseDescriptiveTexts(xmlPullParser, map);
} else {
str = xmlPullParser.getName();
}
}
}
public static Session.Feature parseSessionFeature(XmlPullParser xmlPullParser) throws XmlPullParserException, IOException {
ParserUtils.assertAtStartTag(xmlPullParser);
int depth = xmlPullParser.getDepth();
boolean z = false;
if (!xmlPullParser.isEmptyElementTag()) {
while (true) {
int next = xmlPullParser.next();
if (next == 2) {
String name = xmlPullParser.getName();
name.getClass();
if (name.equals(Session.Feature.OPTIONAL_ELEMENT)) {
z = true;
}
} else if (next == 3 && xmlPullParser.getDepth() == depth) {
break;
}
}
}
return new Session.Feature(z);
}
public static Stanza parseStanza(String str) throws XmlPullParserException, IOException, SmackException {
return parseStanza(getParserFor(str));
}
public static StartTls parseStartTlsFeature(XmlPullParser xmlPullParser) throws XmlPullParserException, IOException {
int depth = xmlPullParser.getDepth();
boolean z = false;
while (true) {
int next = xmlPullParser.next();
if (next == 2) {
String name = xmlPullParser.getName();
name.getClass();
if (name.equals("required")) {
z = true;
}
} else if (next == 3 && xmlPullParser.getDepth() == depth) {
return new StartTls(z);
}
}
}
public static StreamError parseStreamError(XmlPullParser xmlPullParser) throws IOException, XmlPullParserException, SmackException {
int depth = xmlPullParser.getDepth();
ArrayList arrayList = new ArrayList();
StreamError.Condition condition = null;
String str = null;
Map<String, String> map = null;
while (true) {
int next = xmlPullParser.next();
if (next == 2) {
String name = xmlPullParser.getName();
String namespace = xmlPullParser.getNamespace();
namespace.getClass();
if (namespace.equals(StreamError.NAMESPACE)) {
name.getClass();
if (name.equals("text")) {
map = parseDescriptiveTexts(xmlPullParser, map);
} else {
condition = StreamError.Condition.fromString(name);
if (!xmlPullParser.isEmptyElementTag()) {
str = xmlPullParser.nextText();
}
}
} else {
addExtensionElement(arrayList, xmlPullParser, name, namespace);
}
} else if (next == 3 && xmlPullParser.getDepth() == depth) {
return new StreamError(condition, str, map, arrayList);
}
}
}
public static void addExtensionElement(Collection<ExtensionElement> collection, XmlPullParser xmlPullParser, String str, String str2) throws XmlPullParserException, IOException, SmackException {
collection.add(parseExtensionElement(str, str2, xmlPullParser));
}
@Deprecated
public static void addPacketExtension(Collection<ExtensionElement> collection, XmlPullParser xmlPullParser, String str, String str2) throws XmlPullParserException, IOException, SmackException {
addExtensionElement(collection, xmlPullParser, str, str2);
}
public static XmlPullParser getParserFor(String str) throws XmlPullParserException, IOException {
return getParserFor(new StringReader(str));
}
public static XmlPullParser newXmppParser(Reader reader) throws XmlPullParserException {
XmlPullParser newXmppParser = newXmppParser();
newXmppParser.setInput(reader);
return newXmppParser;
}
public static CharSequence parseContentDepth(XmlPullParser xmlPullParser, int i, boolean z) throws XmlPullParserException, IOException {
return xmlPullParser.getFeature(FEATURE_XML_ROUNDTRIP) ? parseContentDepthWithRoundtrip(xmlPullParser, i, z) : parseContentDepthWithoutRoundtrip(xmlPullParser, i, z);
}
public static CharSequence parseElement(XmlPullParser xmlPullParser, boolean z) throws XmlPullParserException, IOException {
return parseContentDepth(xmlPullParser, xmlPullParser.getDepth(), z);
}
public static Stanza parseStanza(XmlPullParser xmlPullParser) throws XmlPullParserException, IOException, SmackException {
String name;
ParserUtils.assertAtStartTag(xmlPullParser);
name = xmlPullParser.getName();
name.getClass();
switch (name) {
case "presence":
return parsePresence(xmlPullParser);
case "iq":
return parseIQ(xmlPullParser);
case "message":
return parseMessage(xmlPullParser);
default:
throw new IllegalArgumentException("Can only parse message, iq or presence, not ".concat(name));
}
}
public static void addExtensionElement(Stanza stanza, XmlPullParser xmlPullParser) throws XmlPullParserException, IOException, SmackException {
ParserUtils.assertAtStartTag(xmlPullParser);
addExtensionElement(stanza, xmlPullParser, xmlPullParser.getName(), xmlPullParser.getNamespace());
}
@Deprecated
public static void addPacketExtension(Stanza stanza, XmlPullParser xmlPullParser) throws XmlPullParserException, IOException, SmackException {
addExtensionElement(stanza, xmlPullParser);
}
public static XmlPullParser getParserFor(String str, String str2) throws XmlPullParserException, IOException {
XmlPullParser parserFor = getParserFor(str);
while (true) {
int eventType = parserFor.getEventType();
String name = parserFor.getName();
if (eventType == 2 && name.equals(str2)) {
return parserFor;
}
if (eventType == 1) {
throw new IllegalArgumentException(a.m("Could not find start tag '", str2, "' in stanza: ", str));
}
parserFor.next();
}
}
public static void addExtensionElement(Stanza stanza, XmlPullParser xmlPullParser, String str, String str2) throws XmlPullParserException, IOException, SmackException {
stanza.addExtension(parseExtensionElement(str, str2, xmlPullParser));
}
@Deprecated
public static void addPacketExtension(Stanza stanza, XmlPullParser xmlPullParser, String str, String str2) throws XmlPullParserException, IOException, SmackException {
addExtensionElement(stanza, xmlPullParser, str, str2);
}
}