int ff_jni_exception_get_summary(JNIEnv *env, jthrowable exception, char **error, void *log_ctx)

{

    int ret = 0;



    AVBPrint bp;



    char *name = NULL;

    char *message = NULL;



    jclass class_class = NULL;

    jmethodID get_name_id = NULL;



    jclass exception_class = NULL;

    jmethodID get_message_id = NULL;



    jstring string;



    av_bprint_init(&bp, 0, AV_BPRINT_SIZE_AUTOMATIC);



    exception_class = (*env)->GetObjectClass(env, exception);

    if ((*env)->ExceptionCheck(env)) {

        (*env)->ExceptionClear(env);

        av_log(log_ctx, AV_LOG_ERROR, "Could not find Throwable class\n");

        ret = AVERROR_EXTERNAL;

        goto done;

    }



    class_class = (*env)->GetObjectClass(env, exception_class);

    if ((*env)->ExceptionCheck(env)) {

        (*env)->ExceptionClear(env);

        av_log(log_ctx, AV_LOG_ERROR, "Could not find Throwable class's class\n");

        ret = AVERROR_EXTERNAL;

        goto done;

    }



    get_name_id = (*env)->GetMethodID(env, class_class, "getName", "()Ljava/lang/String;");

    if ((*env)->ExceptionCheck(env)) {

        (*env)->ExceptionClear(env);

        av_log(log_ctx, AV_LOG_ERROR, "Could not find method Class.getName()\n");

        ret = AVERROR_EXTERNAL;

        goto done;

    }



    string = (*env)->CallObjectMethod(env, exception_class, get_name_id);

    if ((*env)->ExceptionCheck(env)) {

        (*env)->ExceptionClear(env);

        av_log(log_ctx, AV_LOG_ERROR, "Class.getName() threw an exception\n");

        ret = AVERROR_EXTERNAL;

        goto done;

    }



    if (string) {

        name = ff_jni_jstring_to_utf_chars(env, string, log_ctx);

        (*env)->DeleteLocalRef(env, string);

        string = NULL;

    }



    get_message_id = (*env)->GetMethodID(env, exception_class, "getMessage", "()Ljava/lang/String;");

    if ((*env)->ExceptionCheck(env)) {

        (*env)->ExceptionClear(env);

        av_log(log_ctx, AV_LOG_ERROR, "Could not find method java/lang/Throwable.getMessage()\n");

        ret = AVERROR_EXTERNAL;

        goto done;

    }



    string = (*env)->CallObjectMethod(env, exception, get_message_id);

    if ((*env)->ExceptionCheck(env)) {

        (*env)->ExceptionClear(env);

        av_log(log_ctx, AV_LOG_ERROR, "Throwable.getMessage() threw an exception\n");

        ret = AVERROR_EXTERNAL;

        goto done;

    }



    if (string) {

        message = ff_jni_jstring_to_utf_chars(env, string, log_ctx);

        (*env)->DeleteLocalRef(env, string);

        string = NULL;

    }



    if (name && message) {

        av_bprintf(&bp, "%s: %s", name, message);

    } else if (name && !message) {

        av_bprintf(&bp, "%s occurred", name);

    } else if (!name && message) {

        av_bprintf(&bp, "Exception: %s", message);

    } else {

        av_log(log_ctx, AV_LOG_WARNING, "Could not retreive exception name and message\n");

        av_bprintf(&bp, "Exception occurred");

    }



    ret = av_bprint_finalize(&bp, error);

done:



    av_free(name);

    av_free(message);



    if (class_class) {

        (*env)->DeleteLocalRef(env, class_class);

    }



    if (exception_class) {

        (*env)->DeleteLocalRef(env, exception_class);

    }



    if (string) {

        (*env)->DeleteLocalRef(env, string);

    }



    return ret;

}

int ff_jni_exception_get_summary(JNIEnv *env, jthrowable exception, char **error, void *log_ctx)

{

    int ret = 0;



    AVBPrint bp;



    char *name = NULL;

    char *message = NULL;



    jclass class_class = NULL;

    jmethodID get_name_id = NULL;



    jclass exception_class = NULL;

    jmethodID get_message_id = NULL;



    jstring string;



    av_bprint_init(&bp, 0, AV_BPRINT_SIZE_AUTOMATIC);



    exception_class = (*env)->GetObjectClass(env, exception);

    if ((*env)->ExceptionCheck(env)) {

        (*env)->ExceptionClear(env);

        av_log(log_ctx, AV_LOG_ERROR, "Could not find Throwable class\n");

        ret = AVERROR_EXTERNAL;

        goto done;

    }



    class_class = (*env)->GetObjectClass(env, exception_class);

    if ((*env)->ExceptionCheck(env)) {

        (*env)->ExceptionClear(env);

        av_log(log_ctx, AV_LOG_ERROR, "Could not find Throwable class's class\n");

        ret = AVERROR_EXTERNAL;

        goto done;

    }



    get_name_id = (*env)->GetMethodID(env, class_class, "getName", "()Ljava/lang/String;");

    if ((*env)->ExceptionCheck(env)) {

        (*env)->ExceptionClear(env);

        av_log(log_ctx, AV_LOG_ERROR, "Could not find method Class.getName()\n");

        ret = AVERROR_EXTERNAL;

        goto done;

    }



    string = (*env)->CallObjectMethod(env, exception_class, get_name_id);

    if ((*env)->ExceptionCheck(env)) {

        (*env)->ExceptionClear(env);

        av_log(log_ctx, AV_LOG_ERROR, "Class.getName() threw an exception\n");

        ret = AVERROR_EXTERNAL;

        goto done;

    }



    if (string) {

        name = ff_jni_jstring_to_utf_chars(env, string, log_ctx);

        (*env)->DeleteLocalRef(env, string);

        string = NULL;

    }



    get_message_id = (*env)->GetMethodID(env, exception_class, "getMessage", "()Ljava/lang/String;");

    if ((*env)->ExceptionCheck(env)) {

        (*env)->ExceptionClear(env);

        av_log(log_ctx, AV_LOG_ERROR, "Could not find method java/lang/Throwable.getMessage()\n");

        ret = AVERROR_EXTERNAL;

        goto done;

    }



    string = (*env)->CallObjectMethod(env, exception, get_message_id);

    if ((*env)->ExceptionCheck(env)) {

        (*env)->ExceptionClear(env);

        av_log(log_ctx, AV_LOG_ERROR, "Throwable.getMessage() threw an exception\n");

        ret = AVERROR_EXTERNAL;

        goto done;

    }



    if (string) {

        message = ff_jni_jstring_to_utf_chars(env, string, log_ctx);

        (*env)->DeleteLocalRef(env, string);

        string = NULL;

    }



    if (name && message) {

        av_bprintf(&bp, "%s: %s", name, message);

    } else if (name && !message) {

        av_bprintf(&bp, "%s occurred", name);

    } else if (!name && message) {

        av_bprintf(&bp, "Exception: %s", message);

    } else {

        av_log(log_ctx, AV_LOG_WARNING, "Could not retreive exception name and message\n");

        av_bprintf(&bp, "Exception occurred");

    }



    ret = av_bprint_finalize(&bp, error);

done:



    av_free(name);

    av_free(message);



    if (class_class) {

        (*env)->DeleteLocalRef(env, class_class);

    }



    if (exception_class) {

        (*env)->DeleteLocalRef(env, exception_class);

    }



    if (string) {

        (*env)->DeleteLocalRef(env, string);

    }



    return ret;

}

    jstring string;
int FUNC_0(JNIEnv *VAR_0, jthrowable VAR_1, char **VAR_2, void *VAR_3)

{

    int VAR_4 = 0;



    AVBPrint bp;



    char *VAR_5 = NULL;

    char *VAR_6 = NULL;



    jclass class_class = NULL;

    jmethodID get_name_id = NULL;



    jclass exception_class = NULL;

    jmethodID get_message_id = NULL;



    jstring string;



    av_bprint_init(&bp, 0, AV_BPRINT_SIZE_AUTOMATIC);



    exception_class = (*VAR_0)->GetObjectClass(VAR_0, VAR_1);

    if ((*VAR_0)->ExceptionCheck(VAR_0)) {

        (*VAR_0)->ExceptionClear(VAR_0);

        av_log(VAR_3, AV_LOG_ERROR, "Could not find Throwable class\n");

        VAR_4 = AVERROR_EXTERNAL;

        goto done;

    }



    class_class = (*VAR_0)->GetObjectClass(VAR_0, exception_class);

    if ((*VAR_0)->ExceptionCheck(VAR_0)) {

        (*VAR_0)->ExceptionClear(VAR_0);

        av_log(VAR_3, AV_LOG_ERROR, "Could not find Throwable class's class\n");

        VAR_4 = AVERROR_EXTERNAL;

        goto done;

    }



    get_name_id = (*VAR_0)->GetMethodID(VAR_0, class_class, "getName", "()Ljava/lang/String;");

    if ((*VAR_0)->ExceptionCheck(VAR_0)) {

        (*VAR_0)->ExceptionClear(VAR_0);

        av_log(VAR_3, AV_LOG_ERROR, "Could not find method Class.getName()\n");

        VAR_4 = AVERROR_EXTERNAL;

        goto done;

    }



    string = (*VAR_0)->CallObjectMethod(VAR_0, exception_class, get_name_id);

    if ((*VAR_0)->ExceptionCheck(VAR_0)) {

        (*VAR_0)->ExceptionClear(VAR_0);

        av_log(VAR_3, AV_LOG_ERROR, "Class.getName() threw an VAR_1\n");

        VAR_4 = AVERROR_EXTERNAL;

        goto done;

    }



    if (string) {

        VAR_5 = ff_jni_jstring_to_utf_chars(VAR_0, string, VAR_3);

        (*VAR_0)->DeleteLocalRef(VAR_0, string);

        string = NULL;

    }



    get_message_id = (*VAR_0)->GetMethodID(VAR_0, exception_class, "getMessage", "()Ljava/lang/String;");

    if ((*VAR_0)->ExceptionCheck(VAR_0)) {

        (*VAR_0)->ExceptionClear(VAR_0);

        av_log(VAR_3, AV_LOG_ERROR, "Could not find method java/lang/Throwable.getMessage()\n");

        VAR_4 = AVERROR_EXTERNAL;

        goto done;

    }



    string = (*VAR_0)->CallObjectMethod(VAR_0, VAR_1, get_message_id);

    if ((*VAR_0)->ExceptionCheck(VAR_0)) {

        (*VAR_0)->ExceptionClear(VAR_0);

        av_log(VAR_3, AV_LOG_ERROR, "Throwable.getMessage() threw an VAR_1\n");

        VAR_4 = AVERROR_EXTERNAL;

        goto done;

    }



    if (string) {

        VAR_6 = ff_jni_jstring_to_utf_chars(VAR_0, string, VAR_3);

        (*VAR_0)->DeleteLocalRef(VAR_0, string);

        string = NULL;

    }



    if (VAR_5 && VAR_6) {

        av_bprintf(&bp, "%s: %s", VAR_5, VAR_6);

    } else if (VAR_5 && !VAR_6) {

        av_bprintf(&bp, "%s occurred", VAR_5);

    } else if (!VAR_5 && VAR_6) {

        av_bprintf(&bp, "Exception: %s", VAR_6);

    } else {

        av_log(VAR_3, AV_LOG_WARNING, "Could not retreive VAR_1 VAR_5 and VAR_6\n");

        av_bprintf(&bp, "Exception occurred");

    }



    VAR_4 = av_bprint_finalize(&bp, VAR_2);

done:



    av_free(VAR_5);

    av_free(VAR_6);



    if (class_class) {

        (*VAR_0)->DeleteLocalRef(VAR_0, class_class);

    }



    if (exception_class) {

        (*VAR_0)->DeleteLocalRef(VAR_0, exception_class);

    }



    if (string) {

        (*VAR_0)->DeleteLocalRef(VAR_0, string);

    }



    return VAR_4;

}

int FUNC_0(JNIEnv *VAR_0, jthrowable VAR_1, char **VAR_2, void *VAR_3)
{ int VAR_4 = 0; AVBPrint bp; char *VAR_5 = NULL; char *VAR_6 = NULL; jclass class_class = NULL; jmethodID get_name_id = NULL; jclass exception_class = NULL; jmethodID get_message_id = NULL; jstring string; av_bprint_init(&bp, 0, AV_BPRINT_SIZE_AUTOMATIC); exception_class = (*VAR_0)->GetObjectClass(VAR_0, VAR_1); if ((*VAR_0)->ExceptionCheck(VAR_0)) { (*VAR_0)->ExceptionClear(VAR_0); av_log(VAR_3, AV_LOG_ERROR, "Could not find Throwable class\n"); VAR_4 = AVERROR_EXTERNAL; goto done; } class_class = (*VAR_0)->GetObjectClass(VAR_0, exception_class); if ((*VAR_0)->ExceptionCheck(VAR_0)) { (*VAR_0)->ExceptionClear(VAR_0); av_log(VAR_3, AV_LOG_ERROR, "Could not find Throwable class's class\n"); VAR_4 = AVERROR_EXTERNAL; goto done; } get_name_id = (*VAR_0)->GetMethodID(VAR_0, class_class, "getName", "()Ljava/lang/String;"); if ((*VAR_0)->ExceptionCheck(VAR_0)) { (*VAR_0)->ExceptionClear(VAR_0); av_log(VAR_3, AV_LOG_ERROR, "Could not find method Class.getName()\n"); VAR_4 = AVERROR_EXTERNAL; goto done; } string = (*VAR_0)->CallObjectMethod(VAR_0, exception_class, get_name_id); if ((*VAR_0)->ExceptionCheck(VAR_0)) { (*VAR_0)->ExceptionClear(VAR_0); av_log(VAR_3, AV_LOG_ERROR, "Class.getName() threw an VAR_1\n"); VAR_4 = AVERROR_EXTERNAL; goto done; } if (string) { VAR_5 = ff_jni_jstring_to_utf_chars(VAR_0, string, VAR_3); (*VAR_0)->DeleteLocalRef(VAR_0, string); string = NULL; } get_message_id = (*VAR_0)->GetMethodID(VAR_0, exception_class, "getMessage", "()Ljava/lang/String;"); if ((*VAR_0)->ExceptionCheck(VAR_0)) { (*VAR_0)->ExceptionClear(VAR_0); av_log(VAR_3, AV_LOG_ERROR, "Could not find method java/lang/Throwable.getMessage()\n"); VAR_4 = AVERROR_EXTERNAL; goto done; } string = (*VAR_0)->CallObjectMethod(VAR_0, VAR_1, get_message_id); if ((*VAR_0)->ExceptionCheck(VAR_0)) { (*VAR_0)->ExceptionClear(VAR_0); av_log(VAR_3, AV_LOG_ERROR, "Throwable.getMessage() threw an VAR_1\n"); VAR_4 = AVERROR_EXTERNAL; goto done; } if (string) { VAR_6 = ff_jni_jstring_to_utf_chars(VAR_0, string, VAR_3); (*VAR_0)->DeleteLocalRef(VAR_0, string); string = NULL; } if (VAR_5 && VAR_6) { av_bprintf(&bp, "%s: %s", VAR_5, VAR_6); } else if (VAR_5 && !VAR_6) { av_bprintf(&bp, "%s occurred", VAR_5); } else if (!VAR_5 && VAR_6) { av_bprintf(&bp, "Exception: %s", VAR_6); } else { av_log(VAR_3, AV_LOG_WARNING, "Could not retreive VAR_1 VAR_5 and VAR_6\n"); av_bprintf(&bp, "Exception occurred"); } VAR_4 = av_bprint_finalize(&bp, VAR_2); done:
av_free(VAR_5); av_free(VAR_6); if (class_class) { (*VAR_0)->DeleteLocalRef(VAR_0, class_class); } if (exception_class) { (*VAR_0)->DeleteLocalRef(VAR_0, exception_class); } if (string) { (*VAR_0)->DeleteLocalRef(VAR_0, string); } return VAR_4; }