<commit_before>package com.notipon;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.ArrayList;

import android.content.Context;
import android.util.Log;

import com.notipon.Deal;
import com.notipon.Filter;

public class DealFetcher {
    private static final String EXAMPLE_JSON_FILE = "example_deals.json";
    private static final String TAG = "DealFetcher";
    private Context context;
    private static final String grouponKey = "<KEY>";

    public DealFetcher(Context context) {
        this.context = context;
    }

    public ArrayList<Deal> getDeals() {
        return getJsonExampleDeals();
    }

    public ArrayList<Deal> getDeals(Filter filter) {
        return filter.apply(getDeals());
    }

    private ArrayList<Deal> getJsonExampleDeals() {
        return Deal.parseJsonDeals(loadExampleJson());
    }
    
    private String loadStreamAsString(InputStream binaryInput) throws IOException {
        BufferedReader in = new BufferedReader(new InputStreamReader(binaryInput));
        StringBuilder builder = new StringBuilder();
        String line;

        while ((line = in.readLine()) != null) {
            builder.append(line);
        }
        in.close();

        return builder.toString();
    }

    private String loadExampleJson() {
        try {
            return loadStreamAsString(context.getAssets().open(EXAMPLE_JSON_FILE));
        } catch (IOException e) {
            Log.e(TAG, "Failed to load example Json");
        }

        return "";
    }
    
    private URL buildDealRequestUrl() throws MalformedURLException {
	return new URL("http://api.groupon.com/v2/deals/?client_id=" + grouponKey);
    }
    
    private String fetchCurrentDeals() {
        try {
            URL dealUrl = buildDealRequestUrl();
            return loadStreamAsString(dealUrl.openStream());
        }
        catch (MalformedURLException e) {
            Log.e(TAG, "Bad deal URL:", e);
        }
        catch (IOException e) {
            Log.e(TAG, "Failed to load URL:", e);
        }
	
        Log.e(TAG, "Error in fetching current deals, falling back to example Json.");
	return loadExampleJson();
    }
}<commit_msg>Tab-killing<commit_after>package com.notipon;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.ArrayList;

import android.content.Context;
import android.util.Log;

import com.notipon.Deal;
import com.notipon.Filter;

public class DealFetcher {
    private static final String EXAMPLE_JSON_FILE = "example_deals.json";
    private static final String TAG = "DealFetcher";
    private Context context;
    private static final String grouponKey = "<KEY>";

    public DealFetcher(Context context) {
        this.context = context;
    }

    public ArrayList<Deal> getDeals() {
        return getJsonExampleDeals();
    }

    public ArrayList<Deal> getDeals(Filter filter) {
        return filter.apply(getDeals());
    }

    private ArrayList<Deal> getJsonExampleDeals() {
        return Deal.parseJsonDeals(loadExampleJson());
    }
    
    private String loadStreamAsString(InputStream binaryInput) throws IOException {
        BufferedReader in = new BufferedReader(new InputStreamReader(binaryInput));
        StringBuilder builder = new StringBuilder();
        String line;

        while ((line = in.readLine()) != null) {
            builder.append(line);
        }
        in.close();

        return builder.toString();
    }

    private String loadExampleJson() {
        try {
            return loadStreamAsString(context.getAssets().open(EXAMPLE_JSON_FILE));
        } catch (IOException e) {
            Log.e(TAG, "Failed to load example Json");
        }

        return "";
    }
    
    private URL buildDealRequestUrl() throws MalformedURLException {
        return new URL("http://api.groupon.com/v2/deals/?client_id=" + grouponKey);
    }
    
    private String fetchCurrentDeals() {
        try {
            URL dealUrl = buildDealRequestUrl();
            return loadStreamAsString(dealUrl.openStream());
        }
        catch (MalformedURLException e) {
            Log.e(TAG, "Bad deal URL:", e);
        }
        catch (IOException e) {
            Log.e(TAG, "Failed to load URL:", e);
        }
	
        Log.e(TAG, "Error in fetching current deals, falling back to example Json.");
        return loadExampleJson();
    }
}
{'fraction_non_alphanumeric': 0.1033810143042913, 'fraction_numerical': 0.00043346337234503684, 'mean_word_length': 2.703852327447833, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 11, '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': '2496439', 'n_tokens_mistral': 1314, 'n_tokens_neox': 1284, 'n_words': 316}