package org.eclipse.paho.mqttv5.client.internal;

import org.eclipse.paho.mqttv5.common.MqttException;
import org.eclipse.paho.mqttv5.common.MqttSecurityException;

/* JADX INFO: loaded from: classes2.dex */
public class ExceptionHelper {
    public static MqttException createMqttException(int i) {
        if (i == 4 || i == 5) {
            return new MqttSecurityException(i);
        }
        return new MqttException(i);
    }

    public static MqttException createMqttException(Throwable th) {
        if (th.getClass().getName().equals("java.security.GeneralSecurityException")) {
            return new MqttSecurityException(th);
        }
        return new MqttException(th);
    }

    public static boolean isClassAvailable(String str) {
        try {
            Class.forName(str);
            return true;
        } catch (ClassNotFoundException unused) {
            return false;
        }
    }

    private ExceptionHelper() {
    }
}
