淘色 v1.0.8版本的 MD5 值为:91403eb599341d5a291ddc0b7c2d99f3

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


package h.a;

import android.content.Context;
import android.os.SystemClock;
import h.a.b0;
import io.realm.exceptions.RealmException;
import io.realm.exceptions.RealmMigrationNeededException;
import io.realm.exceptions.RealmPrimaryKeyConstraintException;
import io.realm.internal.OsObject;
import io.realm.internal.OsSchemaInfo;
import io.realm.internal.OsSharedRealm;
import io.realm.internal.Table;
import io.realm.internal.UncheckedRow;
import io.realm.internal.Util;
import io.realm.log.RealmLog;
import java.io.File;
import java.lang.reflect.Constructor;
import java.lang.reflect.InvocationTargetException;
import java.util.HashMap;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.Set;
public class x extends h.a.a {
    public static final Object f7892k = new Object();
    public static b0 f7893l;
    public final k0 f7894j;

    public interface a {

        public interface InterfaceC0486a {
            void a(Throwable th);
        }

        public interface b {
            void a();
        }

        void a(x xVar);
    }

    public x(OsSharedRealm osSharedRealm) {
        super(osSharedRealm);
        this.f7894j = new l(this, new h.a.g1.b(this.b.f7778j, osSharedRealm.getSchemaInfo()));
    }

    public static x P() {
        b0 b0Var;
        synchronized (f7892k) {
            b0Var = f7893l;
        }
        if (b0Var == null) {
            if (h.a.a.f7761g == null) {
                throw new IllegalStateException("Call `Realm.init(Context)` before calling this method.");
            }
            throw new IllegalStateException("Set default configuration by using `Realm.setDefaultConfiguration(RealmConfiguration)`.");
        }
        return (x) z.b(b0Var, x.class);
    }

    public static Object Q() {
        try {
            Constructor<?> constructor = Class.forName("io.realm.DefaultRealmModule").getDeclaredConstructors()[0];
            constructor.setAccessible(true);
            return constructor.newInstance(new Object[0]);
        } catch (ClassNotFoundException unused) {
            return null;
        } catch (IllegalAccessException e2) {
            throw new RealmException(g.b.b.a.a.f("Could not create an instance of ", "io.realm.DefaultRealmModule"), e2);
        } catch (InstantiationException e3) {
            throw new RealmException(g.b.b.a.a.f("Could not create an instance of ", "io.realm.DefaultRealmModule"), e3);
        } catch (InvocationTargetException e4) {
            throw new RealmException(g.b.b.a.a.f("Could not create an instance of ", "io.realm.DefaultRealmModule"), e4);
        }
    }

    public static synchronized void R(Context context) {
        synchronized (x.class) {
            S(context, "");
        }
    }

    public static void S(Context context, String str) {
        if (h.a.a.f7761g != null) {
            return;
        }
        if (context != null) {
            File filesDir = context.getFilesDir();
            if (filesDir != null) {
                if (!filesDir.exists()) {
                    try {
                        filesDir.mkdirs();
                    } catch (SecurityException unused) {
                    }
                }
                h.a.g1.m.a(context);
                T(new b0.a(context).a());
                if (h.a.g1.j.b() == null) {
                    if (context.getApplicationContext() != null) {
                        h.a.a.f7761g = context.getApplicationContext();
                    } else {
                        h.a.a.f7761g = context;
                    }
                    OsSharedRealm.initialize(new File(context.getFilesDir(), ".realm.temp"));
                    return;
                }
                throw null;
            }
            if (filesDir == null || !filesDir.exists()) {
                long[] jArr = {1, 2, 5, 10, 16};
                long j2 = 0;
                int i2 = -1;
                do {
                    if (context.getFilesDir() != null && context.getFilesDir().exists()) {
                        break;
                    }
                    i2++;
                    long j3 = jArr[Math.min(i2, 4)];
                    SystemClock.sleep(j3);
                    j2 += j3;
                } while (j2 <= 200);
            }
            if (context.getFilesDir() == null || !context.getFilesDir().exists()) {
                StringBuilder q = g.b.b.a.a.q("Context.getFilesDir() returns ");
                q.append(context.getFilesDir());
                q.append(" which is not an existing directory. See https://issuetracker.google.com/issues/36918154");
                throw new IllegalStateException(q.toString());
            }
            h.a.g1.m.a(context);
            T(new b0.a(context).a());
            if (h.a.g1.j.b() == null) {
            }
        } else {
            throw new IllegalArgumentException("Non-null context required.");
        }
    }

    public static void T(b0 b0Var) {
        synchronized (f7892k) {
            f7893l = b0Var;
        }
    }

    public final <E extends e0> void A(E e2) {
        if (e2 == null) {
            throw new IllegalArgumentException("Null objects cannot be copied into Realm.");
        }
    }

    public final <E extends e0> E E(E e2, boolean z, Map<e0, h.a.g1.n> map, Set<m> set) {
        f();
        if (z()) {
            try {
                return (E) this.b.f7778j.b(this, e2, z, map, set);
            } catch (IllegalStateException e3) {
                if (e3.getMessage().startsWith("Attempting to create an object of type")) {
                    throw new RealmPrimaryKeyConstraintException(e3.getMessage());
                }
                throw e3;
            }
        }
        throw new IllegalStateException("`copyOrUpdate` can only be called inside a write transaction.");
    }

    public <E extends e0> E J(E e2, m... mVarArr) {
        A(e2);
        return (E) E(e2, false, new HashMap(), Util.b(mVarArr));
    }

    public <E extends e0> E M(Class<E> cls, Object obj, boolean z, List<String> list) {
        Table e2 = this.f7894j.e(cls);
        h.a.g1.o oVar = this.b.f7778j;
        UncheckedRow createWithPrimaryKey = OsObject.createWithPrimaryKey(e2, obj);
        k0 k0Var = this.f7894j;
        k0Var.a();
        return (E) oVar.i(cls, this, createWithPrimaryKey, k0Var.f7860f.a(cls), z, list);
    }

    public void N(a aVar) {
        c();
        try {
            aVar.a(this);
            g();
        } catch (Throwable th) {
            if (z()) {
                e();
            } else {
                RealmLog.c("Could not cancel transaction, not currently in a transaction.", new Object[0]);
            }
            throw th;
        }
    }

    public h.a.g1.t.b O(a aVar, a.b bVar) {
        f();
        boolean a2 = ((h.a.g1.s.a) this.f7765d.capabilities).a();
        ((h.a.g1.s.a) this.f7765d.capabilities).b("Callback cannot be delivered on current thread.");
        return new h.a.g1.t.b(h.a.a.f7762h.a(new w(this, this.b, aVar, a2, bVar, this.f7765d.realmNotifier, null)), h.a.a.f7762h);
    }

    @Override
    public k0 r() {
        return this.f7894j;
    }

    public x(z zVar) {
        super(zVar, new OsSchemaInfo(zVar.f7899c.f7778j.d().values()));
        this.f7894j = new l(this, new h.a.g1.b(this.b.f7778j, this.f7765d.getSchemaInfo()));
        b0 b0Var = this.b;
        if (b0Var.f7781m) {
            h.a.g1.o oVar = b0Var.f7778j;
            for (Class<? extends e0> cls : oVar.f()) {
                String k2 = Table.k(oVar.g(cls));
                if (!this.f7765d.hasTable(k2)) {
                    this.f7765d.close();
                    throw new RealmMigrationNeededException(this.b.f7771c, String.format(Locale.US, "Cannot open the read only Realm. '%s' is missing.", Table.e(k2)));
                }
            }
        }
    }
}