- 28,932 files - Full Java source code - Smali files - Resources Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
163 lines
5.1 KiB
Java
163 lines
5.1 KiB
Java
package com.applovin.impl;
|
|
|
|
import android.util.Xml;
|
|
import com.applovin.impl.sdk.utils.StringUtils;
|
|
import java.util.Arrays;
|
|
import java.util.Collections;
|
|
import java.util.HashMap;
|
|
import java.util.Map;
|
|
import java.util.Stack;
|
|
import java.util.concurrent.TimeUnit;
|
|
import org.xml.sax.Attributes;
|
|
import org.xml.sax.ContentHandler;
|
|
import org.xml.sax.Locator;
|
|
import org.xml.sax.SAXException;
|
|
|
|
/* loaded from: classes.dex */
|
|
public class fs {
|
|
private final com.applovin.impl.sdk.n a;
|
|
private Stack b;
|
|
private StringBuilder c;
|
|
private long d;
|
|
private b e;
|
|
|
|
public fs(com.applovin.impl.sdk.j jVar) {
|
|
if (jVar != null) {
|
|
this.a = jVar.J();
|
|
return;
|
|
}
|
|
throw new IllegalArgumentException("No sdk specified.");
|
|
}
|
|
|
|
public class a implements ContentHandler {
|
|
@Override // org.xml.sax.ContentHandler
|
|
public void characters(char[] cArr, int i, int i2) {
|
|
String trim = new String(Arrays.copyOfRange(cArr, i, i2)).trim();
|
|
if (StringUtils.isValidString(trim)) {
|
|
fs.this.c.append(trim);
|
|
}
|
|
}
|
|
|
|
@Override // org.xml.sax.ContentHandler
|
|
public void endPrefixMapping(String str) {
|
|
}
|
|
|
|
@Override // org.xml.sax.ContentHandler
|
|
public void ignorableWhitespace(char[] cArr, int i, int i2) {
|
|
}
|
|
|
|
@Override // org.xml.sax.ContentHandler
|
|
public void processingInstruction(String str, String str2) {
|
|
}
|
|
|
|
@Override // org.xml.sax.ContentHandler
|
|
public void setDocumentLocator(Locator locator) {
|
|
}
|
|
|
|
@Override // org.xml.sax.ContentHandler
|
|
public void skippedEntity(String str) {
|
|
}
|
|
|
|
@Override // org.xml.sax.ContentHandler
|
|
public void startPrefixMapping(String str, String str2) {
|
|
}
|
|
|
|
public a() {
|
|
}
|
|
|
|
@Override // org.xml.sax.ContentHandler
|
|
public void startDocument() {
|
|
com.applovin.impl.sdk.n unused = fs.this.a;
|
|
if (com.applovin.impl.sdk.n.a()) {
|
|
fs.this.a.a("XmlParser", "Begin parsing...");
|
|
}
|
|
fs.this.d = TimeUnit.MILLISECONDS.toSeconds(System.currentTimeMillis());
|
|
}
|
|
|
|
@Override // org.xml.sax.ContentHandler
|
|
public void endDocument() {
|
|
long seconds = TimeUnit.MILLISECONDS.toSeconds(System.currentTimeMillis()) - fs.this.d;
|
|
com.applovin.impl.sdk.n unused = fs.this.a;
|
|
if (com.applovin.impl.sdk.n.a()) {
|
|
fs.this.a.a("XmlParser", "Finished parsing in " + seconds + " seconds");
|
|
}
|
|
}
|
|
|
|
@Override // org.xml.sax.ContentHandler
|
|
public void startElement(String str, String str2, String str3, Attributes attributes) {
|
|
try {
|
|
b bVar = !fs.this.b.isEmpty() ? (b) fs.this.b.peek() : null;
|
|
b bVar2 = new b(str2, fs.this.a(attributes), bVar);
|
|
if (bVar != null) {
|
|
bVar.a(bVar2);
|
|
}
|
|
fs.this.b.push(bVar2);
|
|
} catch (Exception e) {
|
|
com.applovin.impl.sdk.n unused = fs.this.a;
|
|
if (com.applovin.impl.sdk.n.a()) {
|
|
fs.this.a.a("XmlParser", "Unable to process element <" + str2 + ">", e);
|
|
}
|
|
throw new SAXException("Failed to start element", e);
|
|
}
|
|
}
|
|
|
|
@Override // org.xml.sax.ContentHandler
|
|
public void endElement(String str, String str2, String str3) {
|
|
fs fsVar = fs.this;
|
|
fsVar.e = (b) fsVar.b.pop();
|
|
fs.this.e.d(fs.this.c.toString().trim());
|
|
fs.this.c.setLength(0);
|
|
}
|
|
}
|
|
|
|
public static class b extends es {
|
|
public void d(String str) {
|
|
this.d = str;
|
|
}
|
|
|
|
public b(String str, Map map, es esVar) {
|
|
super(str, map, esVar);
|
|
}
|
|
|
|
public void a(es esVar) {
|
|
if (esVar != null) {
|
|
this.e.add(esVar);
|
|
return;
|
|
}
|
|
throw new IllegalArgumentException("None specified.");
|
|
}
|
|
}
|
|
|
|
/* JADX INFO: Access modifiers changed from: private */
|
|
public Map a(Attributes attributes) {
|
|
if (attributes != null) {
|
|
int length = attributes.getLength();
|
|
HashMap hashMap = new HashMap(length);
|
|
for (int i = 0; i < length; i++) {
|
|
hashMap.put(attributes.getQName(i), attributes.getValue(i));
|
|
}
|
|
return hashMap;
|
|
}
|
|
return Collections.emptyMap();
|
|
}
|
|
|
|
public es a(String str) {
|
|
if (str != null) {
|
|
this.c = new StringBuilder();
|
|
this.b = new Stack();
|
|
this.e = null;
|
|
Xml.parse(str, new a());
|
|
b bVar = this.e;
|
|
if (bVar != null) {
|
|
return bVar;
|
|
}
|
|
throw new SAXException("Unable to parse XML into node");
|
|
}
|
|
throw new IllegalArgumentException("Unable to parse. No XML specified.");
|
|
}
|
|
|
|
public static es a(String str, com.applovin.impl.sdk.j jVar) {
|
|
return new fs(jVar).a(str);
|
|
}
|
|
}
|