<commit_before>package com.braintreepayments.demo;

import android.app.Activity;
import android.app.AlertDialog;
import android.os.Bundle;

import com.braintreepayments.api.Braintree;
import com.loopj.android.http.AsyncHttpClient;
import com.loopj.android.http.AsyncHttpResponseHandler;
import com.loopj.android.http.RequestParams;

public abstract class BaseActivity extends Activity {

    protected static final String BASE_SERVER_URL = "https://braintree-sample-merchant.herokuapp.com";

    protected AsyncHttpClient mHttpClient;

    protected Braintree mBraintree;

    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        mHttpClient = new AsyncHttpClient();
        getClientToken();
    }

    public abstract void ready(String clientToken);

    @SuppressWarnings("deprecation")
    protected void postNonceToServer(String nonce) {
        RequestParams params = new RequestParams();
        params.put("nonce", nonce);
        mHttpClient.post(BASE_SERVER_URL + "/nonce/transaction", params,
                new AsyncHttpResponseHandler() {
                    @Override
                    public void onSuccess(String response) {
                        showDialog(response);
                    }
                });
    }

    @SuppressWarnings("deprecation")
    private void getClientToken() {
        mHttpClient.get(BASE_SERVER_URL + "/client_token", new AsyncHttpResponseHandler() {
            @Override
            public void onSuccess(String response) {
                ready(response);
            }

            @Override
            public void onFailure(int statusCode, Throwable error, String errorMessage) {
                showDialog("Unable to get a client token. Status code: " + statusCode + ". Error:" + errorMessage);
            }
        });
    }

    protected void showDialog(String message) {
        new AlertDialog.Builder(this)
                .setMessage(message)
                .show();
    }
}<commit_msg>Updated demo app to properly handle test app's client token response format<commit_after>package com.braintreepayments.demo;

import android.app.Activity;
import android.app.AlertDialog;
import android.os.Bundle;

import com.braintreepayments.api.Braintree;
import com.loopj.android.http.AsyncHttpClient;
import com.loopj.android.http.AsyncHttpResponseHandler;
import com.loopj.android.http.RequestParams;

import org.json.JSONException;
import org.json.JSONObject;

public abstract class BaseActivity extends Activity {

    protected static final String BASE_SERVER_URL = "https://braintree-sample-merchant.herokuapp.com";

    protected AsyncHttpClient mHttpClient;

    protected Braintree mBraintree;

    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        mHttpClient = new AsyncHttpClient();
        getClientToken();
    }

    public abstract void ready(String clientToken);

    @SuppressWarnings("deprecation")
    protected void postNonceToServer(String nonce) {
        RequestParams params = new RequestParams();
        params.put("nonce", nonce);
        mHttpClient.post(BASE_SERVER_URL + "/nonce/transaction", params,
                new AsyncHttpResponseHandler() {
                    @Override
                    public void onSuccess(String response) {
                        showDialog(response);
                    }
                });
    }

    @SuppressWarnings("deprecation")
    private void getClientToken() {
        mHttpClient.get(BASE_SERVER_URL + "/client_token", new AsyncHttpResponseHandler() {
            @Override
            public void onSuccess(String response) {
                try {
                    JSONObject json = new JSONObject(response);
                    ready(json.getString("client_token"));
                } catch (JSONException e) {
                    showDialog("Unable to fetch a client token!");
                }
            }

            @Override
            public void onFailure(int statusCode, Throwable error, String errorMessage) {
                showDialog("Unable to get a client token. Status code: " + statusCode + ". Error:" + errorMessage);
            }
        });
    }

    protected void showDialog(String message) {
        new AlertDialog.Builder(this)
                .setMessage(message)
                .show();
    }
}
{'fraction_non_alphanumeric': 0.0863210778716602, 'fraction_numerical': 0.0, 'mean_word_length': 2.4138737334372564, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1563663', 'n_tokens_mistral': 1133, 'n_tokens_neox': 1085, 'n_words': 253}