金坛河长通 v1.1.6版本的 MD5 值为:20e883288031684b3415ea19cd21af4d
以下内容为反编译后的 b.java 源代码,内容仅作参考
package com.esri.arcgisruntime.internal.k;
import com.esri.arcgisruntime.internal.e.a.a.h;
import com.esri.arcgisruntime.internal.n.p;
import com.esri.arcgisruntime.internal.n.y;
import com.esri.arcgisruntime.security.AuthenticationType;
import com.esri.arcgisruntime.security.Credential;
import com.esri.arcgisruntime.security.TokenCredential;
import com.google.gson.stream.JsonReader;
import com.google.gson.stream.JsonWriter;
import java.io.IOException;
import java.io.StringReader;
import java.io.StringWriter;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
public final class b {
private static final String JSON_CREDENTIAL = "credential";
private static final String JSON_SERVER_CONTEXT = "serverContext";
private static b sInstance;
private final ConcurrentHashMap<String, C0017b> mCredentialCache = new ConcurrentHashMap<>(4, 0.75f, 4);
public enum a {
INVALID,
UNDETERMINED,
VALID
}
private b() {
}
public static b a() {
if (sInstance == null) {
sInstance = new b();
}
return sInstance;
}
public void a(String str, Credential credential) {
this.mCredentialCache.put(str, new C0017b(credential, a.UNDETERMINED, true));
}
public C0017b a(String str) {
C0017b c0017b;
C0017b c0017b2 = this.mCredentialCache.get(str);
if (c0017b2 != null) {
c0017b = c0017b2;
} else if (str.toLowerCase().startsWith("www.")) {
c0017b = this.mCredentialCache.get(str.substring(4));
} else {
c0017b = this.mCredentialCache.get("www." + str);
}
if (c0017b == null && str.toLowerCase().contains("www.arcgis.com")) {
for (Map.Entry<String, C0017b> entry : this.mCredentialCache.entrySet()) {
if (entry.getKey().toLowerCase().contains("maps.arcgis.com")) {
return entry.getValue();
}
}
}
return c0017b;
}
public g b(String str) {
C0017b a2 = a(str);
if (a2 != null) {
Object a3 = a2.a();
if (a3 instanceof TokenCredential) {
return ((TokenCredential) a3).getToken();
}
}
return null;
}
public void b(String str, Credential credential) {
C0017b c0017b = this.mCredentialCache.get(str);
if (c0017b != null && c0017b.a() != null && c0017b.a().equals(credential)) {
this.mCredentialCache.remove(str);
}
}
public void a(String str, Credential credential, a aVar) {
C0017b a2 = a(str);
if (a2 != null && a2.a() != null && a2.a().equals(credential) && a2.b() != aVar) {
if (aVar == a.INVALID) {
b(str, credential);
}
a2.a(aVar);
} else if (a2 == null && aVar == a.VALID && credential != null) {
this.mCredentialCache.put(str, new C0017b(credential, a.VALID, false));
}
}
public void c(String str, Credential credential) {
C0017b a2 = a(str);
if (a2 != null && a2.c()) {
a(str, credential, a.INVALID);
}
}
public void b() {
this.mCredentialCache.clear();
h.a(AuthenticationType.TOKEN);
d();
}
private static void d() {
try {
com.esri.arcgisruntime.internal.e.a.d.b();
} catch (IOException e) {
}
h.a(AuthenticationType.HTTP);
}
public String c() {
String str;
StringWriter stringWriter = new StringWriter();
JsonWriter a2 = p.a(stringWriter);
try {
try {
a2.beginArray();
for (Map.Entry<String, C0017b> entry : this.mCredentialCache.entrySet()) {
if (entry.getValue().b() != a.INVALID) {
a2.beginObject().name(JSON_SERVER_CONTEXT).value(entry.getKey()).name(JSON_CREDENTIAL).value(entry.getValue().a().toJson()).endObject();
}
}
a2.endArray();
str = stringWriter.toString();
} finally {
try {
a2.close();
} catch (IOException e) {
}
}
} catch (IOException e2) {
str = null;
}
try {
a2.close();
try {
a2.close();
} catch (IOException e3) {
}
} catch (IOException e4) {
return str;
}
return str;
}
public void c(String str) {
if (y.a(str)) {
throw new IllegalArgumentException("CredentialCache json cannot be null or empty string.");
}
this.mCredentialCache.clear();
JsonReader jsonReader = new JsonReader(new StringReader(str));
try {
try {
jsonReader.beginArray();
while (jsonReader.hasNext()) {
jsonReader.beginObject();
Credential credential = null;
String str2 = null;
while (jsonReader.hasNext()) {
String nextName = jsonReader.nextName();
if (JSON_SERVER_CONTEXT.equals(nextName)) {
str2 = jsonReader.nextString();
} else if (JSON_CREDENTIAL.equals(nextName)) {
credential = Credential.fromJson(jsonReader.nextString());
} else {
jsonReader.skipValue();
}
}
jsonReader.endObject();
if (str2 != null && credential != null) {
this.mCredentialCache.put(str2, new C0017b(credential, a.UNDETERMINED, false));
}
}
} catch (IOException e) {
throw new IllegalArgumentException(e.getMessage(), e);
}
} finally {
try {
jsonReader.close();
} catch (IOException e2) {
}
}
}
public final class C0017b {
private final Credential mCredential;
private volatile boolean mIsValidating;
private volatile a mValidity;
public C0017b(Credential credential, a aVar, boolean z) {
this.mCredential = credential;
this.mValidity = aVar;
this.mIsValidating = z;
}
public Credential a() {
return this.mCredential;
}
public a b() {
return this.mValidity;
}
public synchronized void a(a aVar) {
this.mValidity = aVar;
this.mIsValidating = false;
notifyAll();
}
public boolean c() {
return this.mIsValidating;
}
public void a(boolean z) {
this.mIsValidating = z;
}
}
}