<commit_before>package cgeo.geocaching;

import cgeo.geocaching.activity.AbstractActivity;
import cgeo.geocaching.connector.gc.GCParser;
import cgeo.geocaching.connector.gc.Login;
import cgeo.geocaching.enumerations.LogType;
import cgeo.geocaching.enumerations.StatusCode;
import cgeo.geocaching.network.Network;
import cgeo.geocaching.network.Parameters;
import cgeo.geocaching.twitter.Twitter;
import cgeo.geocaching.ui.DateDialog;
import cgeo.geocaching.ui.Formatter;
import cgeo.geocaching.utils.Log;

import org.apache.commons.lang3.StringUtils;

import android.app.Dialog;
import android.app.ProgressDialog;
import android.content.res.Configuration;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.view.ContextMenu;
import android.view.Menu;
import android.view.MenuItem;
import android.view.SubMenu;
import android.view.View;
import android.widget.Button;
import android.widget.CheckBox;
import android.widget.EditText;
import android.widget.LinearLayout;
import android.widget.TextView;

import java.util.ArrayList;
import java.util.Calendar;
import java.util.List;

public class cgeotouch extends AbstractActivity implements DateDialog.DateDialogParent {
    private List<LogType> logTypes = new ArrayList<LogType>();
    private ProgressDialog waitDialog = null;
    private String guid = null;
    private String geocode = null;
    private String[] viewstates = null;
    private boolean gettingViewstate = true;
    private Calendar date = Calendar.getInstance();
    private LogType typeSelected = LogType.LOG_UNKNOWN;
    private int attempts = 0;
    private CheckBox tweetCheck = null;
    private LinearLayout tweetBox = null;

    private static final int MSG_UPDATE_TYPE = 1;

    private Handler showProgressHandler = new Handler() {
        @Override
        public void handleMessage(Message msg) {
            showProgress(true);
        }
    };

    private Handler loadDataHandler = new Handler() {
        @Override
        public void handleMessage(Message msg) {
            if (MSG_UPDATE_TYPE == msg.what) {
                setType((LogType) msg.obj);
                showToast(res.getString(R.string.info_log_type_changed));
            } else {
                if (Login.isEmpty(viewstates) && attempts < 2) {
                    showToast(res.getString(R.string.err_log_load_data_again));

                    loadData thread;
                    thread = new loadData(guid);
                    thread.start();

                    return;
                } else if (Login.isEmpty(viewstates) && attempts >= 2) {
                    showToast(res.getString(R.string.err_log_load_data));
                    showProgress(false);

                    return;
                }

                gettingViewstate = false; // we're done, user can post log

                Button buttonPost = (Button) findViewById(R.id.post);
                buttonPost.setEnabled(true);
                buttonPost.setOnClickListener(new postListener());

                showProgress(false);
            }
        }
    };

    private Handler postLogHandler = new Handler() {
        @Override
        public void handleMessage(Message msg) {
            if (waitDialog != null) {
                waitDialog.dismiss();
            }

            final StatusCode error = (StatusCode) msg.obj;
            if (error == StatusCode.NO_ERROR) {
                showToast(res.getString(R.string.info_log_posted));
                finish();
            } else {
                showToast(error.getErrorString(res));
            }
        }
    };

    public cgeotouch() {
        super("c:geo-log-trackable");
    }

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        setTheme();
        setContentView(R.layout.touch);
        setTitle(res.getString(R.string.trackable_touch));

        // get parameters
        Bundle extras = getIntent().getExtras();
        if (extras != null) {
            geocode = extras.getString("geocode");
            guid = extras.getString("guid");

            if (StringUtils.isNotBlank(extras.getString("trackingcode"))) {
                ((EditText) findViewById(R.id.tracking)).setText(extras.getString("trackingcode"));
            }
        }

        final cgTrackable trackable = app.getTrackableByGeocode("logging trackable");

        if (StringUtils.isNotBlank(trackable.getName())) {
            setTitle(res.getString(R.string.trackable_touch) + trackable.getName());
        } else {
            setTitle(res.getString(R.string.trackable_touch) + trackable.getGeocode().toUpperCase());
        }

        app.setAction("logging trackable");

        if (trackable == null || guid == null) {
            showToast(res.getString(R.string.err_tb_forgot_saw));

            finish();
            return;
        }

        init();
    }

    @Override
    public void onResume() {
        super.onResume();

    }<commit_msg>Refactoring: variable cannot be null at this point<commit_after>package cgeo.geocaching;

import cgeo.geocaching.activity.AbstractActivity;
import cgeo.geocaching.connector.gc.GCParser;
import cgeo.geocaching.connector.gc.Login;
import cgeo.geocaching.enumerations.LogType;
import cgeo.geocaching.enumerations.StatusCode;
import cgeo.geocaching.network.Network;
import cgeo.geocaching.network.Parameters;
import cgeo.geocaching.twitter.Twitter;
import cgeo.geocaching.ui.DateDialog;
import cgeo.geocaching.ui.Formatter;
import cgeo.geocaching.utils.Log;

import org.apache.commons.lang3.StringUtils;

import android.app.Dialog;
import android.app.ProgressDialog;
import android.content.res.Configuration;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.view.ContextMenu;
import android.view.Menu;
import android.view.MenuItem;
import android.view.SubMenu;
import android.view.View;
import android.widget.Button;
import android.widget.CheckBox;
import android.widget.EditText;
import android.widget.LinearLayout;
import android.widget.TextView;

import java.util.ArrayList;
import java.util.Calendar;
import java.util.List;

public class cgeotouch extends AbstractActivity implements DateDialog.DateDialogParent {
    private List<LogType> logTypes = new ArrayList<LogType>();
    private ProgressDialog waitDialog = null;
    private String guid = null;
    private String geocode = null;
    private String[] viewstates = null;
    private boolean gettingViewstate = true;
    private Calendar date = Calendar.getInstance();
    private LogType typeSelected = LogType.LOG_UNKNOWN;
    private int attempts = 0;
    private CheckBox tweetCheck = null;
    private LinearLayout tweetBox = null;

    private static final int MSG_UPDATE_TYPE = 1;

    private Handler showProgressHandler = new Handler() {
        @Override
        public void handleMessage(Message msg) {
            showProgress(true);
        }
    };

    private Handler loadDataHandler = new Handler() {
        @Override
        public void handleMessage(Message msg) {
            if (MSG_UPDATE_TYPE == msg.what) {
                setType((LogType) msg.obj);
                showToast(res.getString(R.string.info_log_type_changed));
            } else {
                if (Login.isEmpty(viewstates) && attempts < 2) {
                    showToast(res.getString(R.string.err_log_load_data_again));

                    loadData thread;
                    thread = new loadData(guid);
                    thread.start();

                    return;
                } else if (Login.isEmpty(viewstates) && attempts >= 2) {
                    showToast(res.getString(R.string.err_log_load_data));
                    showProgress(false);

                    return;
                }

                gettingViewstate = false; // we're done, user can post log

                Button buttonPost = (Button) findViewById(R.id.post);
                buttonPost.setEnabled(true);
                buttonPost.setOnClickListener(new postListener());

                showProgress(false);
            }
        }
    };

    private Handler postLogHandler = new Handler() {
        @Override
        public void handleMessage(Message msg) {
            if (waitDialog != null) {
                waitDialog.dismiss();
            }

            final StatusCode error = (StatusCode) msg.obj;
            if (error == StatusCode.NO_ERROR) {
                showToast(res.getString(R.string.info_log_posted));
                finish();
            } else {
                showToast(error.getErrorString(res));
            }
        }
    };

    public cgeotouch() {
        super("c:geo-log-trackable");
    }

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        setTheme();
        setContentView(R.layout.touch);
        setTitle(res.getString(R.string.trackable_touch));

        // get parameters
        Bundle extras = getIntent().getExtras();
        if (extras != null) {
            geocode = extras.getString("geocode");
            guid = extras.getString("guid");

            if (StringUtils.isNotBlank(extras.getString("trackingcode"))) {
                ((EditText) findViewById(R.id.tracking)).setText(extras.getString("trackingcode"));
            }
        }

        final cgTrackable trackable = app.getTrackableByGeocode("logging trackable");

        if (StringUtils.isNotBlank(trackable.getName())) {
            setTitle(res.getString(R.string.trackable_touch) + trackable.getName());
        } else {
            setTitle(res.getString(R.string.trackable_touch) + trackable.getGeocode().toUpperCase());
        }

        app.setAction("logging trackable");

        if (guid == null) {
            showToast(res.getString(R.string.err_tb_forgot_saw));

            finish();
            return;
        }

        init();
    }

    @Override
    public void onResume() {
        super.onResume();

    }
{'fraction_non_alphanumeric': 0.1017982017982018, 'fraction_numerical': 0.000999000999000999, 'mean_word_length': 2.4004755434782608, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, 'https://': 0, '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': '5987333', 'n_tokens_mistral': 2818, 'n_tokens_neox': 2662, 'n_words': 542}