package com.facebook.internal;

import android.os.Bundle;
import com.tencent.matrix.trace.core.AppMethodBeat;
import java.util.ArrayList;
import org.json.JSONArray;
import org.json.JSONObject;

class BundleJSONConverter$7 implements BundleJSONConverter$Setter {
    BundleJSONConverter$7() {
    }

    public final void setOnBundle(Bundle bundle, String str, Object obj) {
        AppMethodBeat.i(72262);
        JSONArray jSONArray = (JSONArray) obj;
        ArrayList arrayList = new ArrayList();
        if (jSONArray.length() == 0) {
            bundle.putStringArrayList(str, arrayList);
            AppMethodBeat.o(72262);
            return;
        }
        int i = 0;
        while (true) {
            int i2 = i;
            if (i2 < jSONArray.length()) {
                Object obj2 = jSONArray.get(i2);
                if (obj2 instanceof String) {
                    arrayList.add((String) obj2);
                    i = i2 + 1;
                } else {
                    IllegalArgumentException illegalArgumentException = new IllegalArgumentException("Unexpected type in an array: " + obj2.getClass());
                    AppMethodBeat.o(72262);
                    throw illegalArgumentException;
                }
            }
            bundle.putStringArrayList(str, arrayList);
            AppMethodBeat.o(72262);
            return;
        }
    }

    public final void setOnJSON(JSONObject jSONObject, String str, Object obj) {
        AppMethodBeat.i(72263);
        IllegalArgumentException illegalArgumentException = new IllegalArgumentException("JSONArray's are not supported in bundles.");
        AppMethodBeat.o(72263);
        throw illegalArgumentException;
    }
}
