a.java 2.26 KB
package com.instabug.library.util.a;

import android.support.annotation.Nullable;
import android.util.Log;
import com.instabug.library.util.InstabugSDKLogger;
import org.json.JSONException;
import org.json.JSONObject;

public class a
{
  public static String a(Throwable paramThrowable)
  {
    return Log.getStackTraceString(paramThrowable);
  }
  
  public static JSONObject a(Throwable paramThrowable, @Nullable String paramString)
  {
    localJSONObject = new JSONObject();
    try
    {
      String str = paramThrowable.getClass().getName();
      Object localObject = str;
      if (paramString != null) {
        localObject = str + "-" + paramString;
      }
      localJSONObject.put("name", localObject);
      str = null;
      localObject = str;
      if (paramThrowable.getStackTrace() != null)
      {
        localObject = str;
        if (paramThrowable.getStackTrace().length > 0) {
          localObject = paramThrowable.getStackTrace()[0];
        }
      }
      if ((localObject != null) && (((StackTraceElement)localObject).getFileName() != null)) {
        localJSONObject.put("location", ((StackTraceElement)localObject).getFileName() + ":" + ((StackTraceElement)localObject).getLineNumber());
      }
      for (;;)
      {
        localJSONObject.put("exception", paramThrowable.toString());
        if (paramThrowable.getMessage() != null) {
          localJSONObject.put("message", paramThrowable.getMessage());
        }
        localJSONObject.put("stackTrace", a(paramThrowable));
        if (paramThrowable.getCause() == null) {
          break;
        }
        localJSONObject.put("cause", a(paramThrowable.getCause(), paramString));
        return localJSONObject;
        InstabugSDKLogger.w(a.class, "Incomplete crash stacktrace, if you're using Proguard, add the following line to your configuration file to have file name and line number in your crash report:");
        InstabugSDKLogger.w(a.class, "-keepattributes SourceFile,LineNumberTable");
      }
      return localJSONObject;
    }
    catch (JSONException paramThrowable)
    {
      paramThrowable.printStackTrace();
    }
  }
}


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