<commit_before>package org.tomasdavid.vehicleroutingproblem;

import android.os.AsyncTask;
import android.widget.ProgressBar;

public class ProgressBarTask extends AsyncTask<Integer, Void, Void> {

    private int progress;

    private VrpFragment fragment;

    public ProgressBarTask(VrpFragment fragment) {
        this.fragment = fragment;
        this.progress = 0;
    }

    @Override
    protected Void doInBackground(Integer... params) {
        progress = 0;
        ProgressBar progressBar = (ProgressBar) fragment.getActivity().findViewById(R.id.progress_bar);
        progressBar.setProgress(progress);

        while (fragment.getVrpSolverTask().isRunning() && progress < progressBar.getMax()) {
            try {
                Thread.sleep(1000);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
            progressBar = (ProgressBar) fragment.getActivity().findViewById(R.id.progress_bar);
            progressBar.incrementProgressBy(1);
            progress++;
        }

        return null;
    }
}<commit_msg>fixed problem with null activity<commit_after>package org.tomasdavid.vehicleroutingproblem;

import android.os.AsyncTask;
import android.support.v4.app.FragmentActivity;
import android.util.Log;
import android.widget.ProgressBar;

public class ProgressBarTask extends AsyncTask<Integer, Void, Void> {

    private static final String TAG = "ProgressBarTask";

    private int progress;

    private VrpFragment fragment;

    public ProgressBarTask(VrpFragment fragment) {
        this.fragment = fragment;
        this.progress = 0;
    }

    @Override
    protected Void doInBackground(Integer... params) {
        progress = 0;
        ProgressBar progressBar = (ProgressBar) fragment.getActivity().findViewById(R.id.progress_bar);
        progressBar.setProgress(progress);

        while (fragment.getVrpSolverTask().isRunning() && progress < progressBar.getMax()) {
            try {
                Thread.sleep(1000);
            } catch (InterruptedException e) {
                Log.e(TAG, "Thread sleep error.", e);
            }

            if (fragment != null) {
                FragmentActivity activity =  fragment.getActivity();
                if (activity != null) {
                    progressBar = (ProgressBar) activity.findViewById(R.id.progress_bar);
                    if (progressBar != null) {
                        progressBar.incrementProgressBy(1);
                    }
                }
            }
            progress++;
        }

        return null;
    }
}
{'fraction_non_alphanumeric': 0.09636222910216719, 'fraction_numerical': 0.005804953560371517, 'mean_word_length': 2.2556675062972293, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 5, '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': '5833936', 'n_tokens_mistral': 694, 'n_tokens_neox': 645, 'n_words': 140}