c.java 3.66 KB
package com.instabug.library;

import android.content.Context;
import com.instabug.library.internal.d.a.h;
import com.instabug.library.model.IssueType;
import com.instabug.library.model.e.a;
import com.instabug.library.model.f;
import com.instabug.library.util.InstabugSDKLogger;
import org.json.JSONException;
import org.json.JSONObject;

public class c
  implements Thread.UncaughtExceptionHandler
{
  private final com.instabug.library.internal.a.a a;
  private com.instabug.library.util.d b;
  private f c;
  private u d;
  
  public c(f paramf, u paramu, com.instabug.library.internal.a.a parama, com.instabug.library.util.d paramd)
  {
    this.b = paramd;
    this.a = parama;
    this.c = paramf;
    this.d = paramu;
  }
  
  public void uncaughtException(Thread paramThread, Throwable paramThrowable)
  {
    if (InstabugFeaturesManager.getInstance().getFeatureState(Feature.CRASH_REPORTING) == Feature.State.DISABLED)
    {
      this.b.a(paramThread, paramThrowable);
      return;
    }
    InstabugSDKLogger.e(Instabug.class, "Instabug Caught an Unhandled Exception: " + paramThrowable.getClass().getCanonicalName(), paramThrowable);
    localObject1 = new JSONObject();
    try
    {
      localObject2 = new JSONObject();
      ((JSONObject)localObject2).put("threadName", paramThread.getName());
      ((JSONObject)localObject2).put("threadId", paramThread.getId());
      ((JSONObject)localObject2).put("threadPriority", paramThread.getPriority());
      ((JSONObject)localObject2).put("threadState", paramThread.getState().toString());
      ThreadGroup localThreadGroup = paramThread.getThreadGroup();
      if (localThreadGroup != null)
      {
        JSONObject localJSONObject = new JSONObject();
        localJSONObject.put("name", localThreadGroup.getName());
        localJSONObject.put("maxPriority", localThreadGroup.getMaxPriority());
        localJSONObject.put("activeCount", localThreadGroup.activeCount());
        ((JSONObject)localObject2).put("threadGroup", localJSONObject);
      }
      ((JSONObject)localObject1).put("thread", localObject2);
      ((JSONObject)localObject1).put("error", com.instabug.library.util.a.a.a(paramThrowable, null));
    }
    catch (JSONException localJSONException)
    {
      try
      {
        this.d.f().run();
        Object localObject2 = new com.instabug.library.model.d(System.currentTimeMillis());
        ((com.instabug.library.model.d)localObject2).b(this.d.o());
        ((com.instabug.library.model.d)localObject2).c(((JSONObject)localObject1).toString());
        ((com.instabug.library.model.d)localObject2).a(IssueType.CRASH);
        localObject1 = Instabug.getApplication();
        if (this.d.m() == null) {
          break label329;
        }
        ((com.instabug.library.model.d)localObject2).a(com.instabug.library.internal.d.a.a((Context)localObject1, this.d.m(), this.d.n()), e.a.d);
        this.c.a((com.instabug.library.model.d)localObject2, this.d.c(), this.a.a((Context)localObject1));
        h.b((com.instabug.library.model.d)localObject2);
        Instabug.onSessionFinished();
        InstabugSDKLogger.i(Instabug.class, "Crash persisted for upload at next startup");
        this.b.a(paramThread, paramThrowable);
        return;
        localJSONException = localJSONException;
        localJSONException.printStackTrace();
      }
      catch (Exception localException)
      {
        for (;;)
        {
          InstabugSDKLogger.e(Instabug.class, "Pre sending runnable failed to run.", localException);
        }
      }
    }
    if (this.d.f() == null) {}
  }
}


/* Location:              /home/merong/decompile/hackery-dex2jar.jar!/com/instabug/library/c.class
 * Java compiler version: 6 (50.0)
 * JD-Core Version:       0.7.1
 */