调研通 v3.0.3版本的 MD5 值为:fe075d21227d488bdb9f6aa09d3b3f35

以下内容为反编译后的 d.java 源代码,内容仅作参考


package com.xiaomi.smack.packet;

import android.os.Bundle;
import android.os.Parcelable;
import android.text.TextUtils;
import com.xiaomi.mipush.sdk.Constants;
import java.io.ByteArrayOutputStream;
import java.io.ObjectOutputStream;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.TimeZone;
import java.util.concurrent.CopyOnWriteArrayList;

public abstract class d {

    public static final DateFormat f10439b;

    private static String f10441d;

    private static long f10442e;

    private String f10443f;
    private String g;
    private String h;
    private String i;
    private String j;
    private String k;
    private List<a> l;
    private final Map<String, Object> m;
    private h n;

    protected static final String f10438a = Locale.getDefault().getLanguage().toLowerCase();

    private static String f10440c = null;

    static {
        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'");
        f10439b = simpleDateFormat;
        simpleDateFormat.setTimeZone(TimeZone.getTimeZone("UTC"));
        f10441d = com.xiaomi.smack.util.d.a(5) + Constants.ACCEPT_TIME_SEPARATOR_SERVER;
        f10442e = 0L;
    }

    public d() {
        this.f10443f = f10440c;
        this.g = null;
        this.h = null;
        this.i = null;
        this.j = null;
        this.k = null;
        this.l = new CopyOnWriteArrayList();
        this.m = new HashMap();
        this.n = null;
    }

    public d(Bundle bundle) {
        this.f10443f = f10440c;
        this.g = null;
        this.h = null;
        this.i = null;
        this.j = null;
        this.k = null;
        this.l = new CopyOnWriteArrayList();
        this.m = new HashMap();
        this.n = null;
        this.h = bundle.getString("ext_to");
        this.i = bundle.getString("ext_from");
        this.j = bundle.getString("ext_chid");
        this.g = bundle.getString("ext_pkt_id");
        Parcelable[] parcelableArray = bundle.getParcelableArray("ext_exts");
        if (parcelableArray != null) {
            this.l = new ArrayList(parcelableArray.length);
            for (Parcelable parcelable : parcelableArray) {
                a a2 = a.a((Bundle) parcelable);
                if (a2 != null) {
                    this.l.add(a2);
                }
            }
        }
        Bundle bundle2 = bundle.getBundle("ext_ERROR");
        if (bundle2 != null) {
            this.n = new h(bundle2);
        }
    }

    public static synchronized String j() {
        String sb;
        synchronized (d.class) {
            StringBuilder sb2 = new StringBuilder();
            sb2.append(f10441d);
            long j = f10442e;
            f10442e = 1 + j;
            sb2.append(Long.toString(j));
            sb = sb2.toString();
        }
        return sb;
    }

    public static String u() {
        return f10438a;
    }

    public void a(a aVar) {
        this.l.add(aVar);
    }

    public void a(h hVar) {
        this.n = hVar;
    }

    public Bundle b() {
        Bundle bundle = new Bundle();
        if (!TextUtils.isEmpty(this.f10443f)) {
            bundle.putString("ext_ns", this.f10443f);
        }
        if (!TextUtils.isEmpty(this.i)) {
            bundle.putString("ext_from", this.i);
        }
        if (!TextUtils.isEmpty(this.h)) {
            bundle.putString("ext_to", this.h);
        }
        if (!TextUtils.isEmpty(this.g)) {
            bundle.putString("ext_pkt_id", this.g);
        }
        if (!TextUtils.isEmpty(this.j)) {
            bundle.putString("ext_chid", this.j);
        }
        h hVar = this.n;
        if (hVar != null) {
            bundle.putBundle("ext_ERROR", hVar.a());
        }
        List<a> list = this.l;
        if (list != null) {
            Bundle[] bundleArr = new Bundle[list.size()];
            int i = 0;
            Iterator<a> it = this.l.iterator();
            while (it.hasNext()) {
                Bundle e2 = it.next().e();
                if (e2 != null) {
                    bundleArr[i] = e2;
                    i++;
                }
            }
            bundle.putParcelableArray("ext_exts", bundleArr);
        }
        return bundle;
    }

    public a b(String str, String str2) {
        for (a aVar : this.l) {
            if (str2 == null || str2.equals(aVar.b())) {
                if (str.equals(aVar.a())) {
                    return aVar;
                }
            }
        }
        return null;
    }

    public abstract String c();

    public boolean equals(Object obj) {
        if (this == obj) {
            return true;
        }
        if (obj == null || getClass() != obj.getClass()) {
            return false;
        }
        d dVar = (d) obj;
        h hVar = this.n;
        if (hVar == null ? dVar.n != null : !hVar.equals(dVar.n)) {
            return false;
        }
        String str = this.i;
        if (str == null ? dVar.i != null : !str.equals(dVar.i)) {
            return false;
        }
        if (!this.l.equals(dVar.l)) {
            return false;
        }
        String str2 = this.g;
        if (str2 == null ? dVar.g != null : !str2.equals(dVar.g)) {
            return false;
        }
        String str3 = this.j;
        if (str3 == null ? dVar.j != null : !str3.equals(dVar.j)) {
            return false;
        }
        Map<String, Object> map = this.m;
        if (map == null ? dVar.m != null : !map.equals(dVar.m)) {
            return false;
        }
        String str4 = this.h;
        if (str4 == null ? dVar.h != null : !str4.equals(dVar.h)) {
            return false;
        }
        String str5 = this.f10443f;
        String str6 = dVar.f10443f;
        if (str5 != null) {
            if (str5.equals(str6)) {
                return true;
            }
        } else if (str6 == null) {
            return true;
        }
        return false;
    }

    public int hashCode() {
        String str = this.f10443f;
        int hashCode = (str != null ? str.hashCode() : 0) * 31;
        String str2 = this.g;
        int hashCode2 = (hashCode + (str2 != null ? str2.hashCode() : 0)) * 31;
        String str3 = this.h;
        int hashCode3 = (hashCode2 + (str3 != null ? str3.hashCode() : 0)) * 31;
        String str4 = this.i;
        int hashCode4 = (hashCode3 + (str4 != null ? str4.hashCode() : 0)) * 31;
        String str5 = this.j;
        int hashCode5 = (((((hashCode4 + (str5 != null ? str5.hashCode() : 0)) * 31) + this.l.hashCode()) * 31) + this.m.hashCode()) * 31;
        h hVar = this.n;
        return hashCode5 + (hVar != null ? hVar.hashCode() : 0);
    }

    public String k() {
        if ("ID_NOT_AVAILABLE".equals(this.g)) {
            return null;
        }
        if (this.g == null) {
            this.g = j();
        }
        return this.g;
    }

    public void k(String str) {
        this.g = str;
    }

    public String l() {
        return this.j;
    }

    public void l(String str) {
        this.j = str;
    }

    public String m() {
        return this.h;
    }

    public void m(String str) {
        this.h = str;
    }

    public String n() {
        return this.i;
    }

    public void n(String str) {
        this.i = str;
    }

    public String o() {
        return this.k;
    }

    public void o(String str) {
        this.k = str;
    }

    public a p(String str) {
        return b(str, null);
    }

    public h p() {
        return this.n;
    }

    public synchronized Object q(String str) {
        Map<String, Object> map = this.m;
        if (map == null) {
            return null;
        }
        return map.get(str);
    }

    public synchronized Collection<a> q() {
        if (this.l == null) {
            return Collections.emptyList();
        }
        return Collections.unmodifiableList(new ArrayList(this.l));
    }

    public synchronized Collection<String> r() {
        if (this.m == null) {
            return Collections.emptySet();
        }
        return Collections.unmodifiableSet(new HashSet(this.m.keySet()));
    }

    public synchronized String s() {
        StringBuilder sb;
        ByteArrayOutputStream byteArrayOutputStream;
        ObjectOutputStream objectOutputStream;
        Exception e2;
        String str;
        sb = new StringBuilder();
        Iterator<a> it = q().iterator();
        while (it.hasNext()) {
            sb.append(it.next().d());
        }
        Map<String, Object> map = this.m;
        if (map != null && !map.isEmpty()) {
            sb.append("<properties xmlns=\"http://www.jivesoftware.com/xmlns/xmpp/properties\">");
            for (String str2 : r()) {
                Object q = q(str2);
                sb.append("<property>");
                sb.append("<name>");
                sb.append(com.xiaomi.smack.util.d.a(str2));
                sb.append("</name>");
                sb.append("<value type=\"");
                if (q instanceof Integer) {
                    sb.append("integer\">");
                    sb.append(q);
                    str = "</value>";
                } else if (q instanceof Long) {
                    sb.append("long\">");
                    sb.append(q);
                    str = "</value>";
                } else if (q instanceof Float) {
                    sb.append("float\">");
                    sb.append(q);
                    str = "</value>";
                } else if (q instanceof Double) {
                    sb.append("double\">");
                    sb.append(q);
                    str = "</value>";
                } else if (q instanceof Boolean) {
                    sb.append("boolean\">");
                    sb.append(q);
                    str = "</value>";
                } else if (q instanceof String) {
                    sb.append("string\">");
                    sb.append(com.xiaomi.smack.util.d.a((String) q));
                    str = "</value>";
                } else {
                    ObjectOutputStream objectOutputStream2 = null;
                    try {
                        byteArrayOutputStream = new ByteArrayOutputStream();
                        try {
                            objectOutputStream = new ObjectOutputStream(byteArrayOutputStream);
                            try {
                                try {
                                    objectOutputStream.writeObject(q);
                                    sb.append("java-object\">");
                                    sb.append(com.xiaomi.smack.util.d.a(byteArrayOutputStream.toByteArray()));
                                    sb.append("</value>");
                                    try {
                                        objectOutputStream.close();
                                    } catch (Exception unused) {
                                    }
                                } catch (Throwable th) {
                                    th = th;
                                    objectOutputStream2 = objectOutputStream;
                                    if (objectOutputStream2 != null) {
                                        try {
                                            objectOutputStream2.close();
                                        } catch (Exception unused2) {
                                        }
                                    }
                                    if (byteArrayOutputStream == null) {
                                        throw th;
                                    }
                                    try {
                                        byteArrayOutputStream.close();
                                        throw th;
                                    } catch (Exception unused3) {
                                        throw th;
                                    }
                                }
                            } catch (Exception e3) {
                                e2 = e3;
                                e2.printStackTrace();
                                if (objectOutputStream != null) {
                                    try {
                                        objectOutputStream.close();
                                    } catch (Exception unused4) {
                                    }
                                }
                                if (byteArrayOutputStream == null) {
                                    sb.append("</property>");
                                }
                                byteArrayOutputStream.close();
                            }
                        } catch (Exception e4) {
                            e = e4;
                            objectOutputStream = null;
                            e2 = e;
                            e2.printStackTrace();
                            if (objectOutputStream != null) {
                            }
                            if (byteArrayOutputStream == null) {
                            }
                            byteArrayOutputStream.close();
                        } catch (Throwable th2) {
                            th = th2;
                        }
                    } catch (Exception e5) {
                        e = e5;
                        byteArrayOutputStream = null;
                        objectOutputStream = null;
                    } catch (Throwable th3) {
                        th = th3;
                        byteArrayOutputStream = null;
                    }
                    try {
                        byteArrayOutputStream.close();
                    } catch (Exception unused5) {
                    }
                }
                sb.append(str);
                sb.append("</property>");
            }
            sb.append("</properties>");
        }
        return sb.toString();
    }

    public String t() {
        return this.f10443f;
    }
}