<commit_before>package org.wikimedia.commons;

import android.os.*;
import android.util.*;
import in.yuvi.http.fluent.Http;
import org.apache.http.HttpResponse;
import org.json.*;
import java.io.IOException;
import java.net.*;

public class EventLog {
    private static class LogTask extends AsyncTask<LogBuilder, Void, Boolean> {

        @Override
        protected Boolean doInBackground(LogBuilder... logBuilders) {

            boolean  allSuccess = true;
            // Not using the default URL connection, since that seems to have different behavior than the rest of the code
            for(LogBuilder logBuilder: logBuilders) {
                HttpURLConnection conn;
                try {

                    URL url = logBuilder.toUrl();
                    HttpResponse response = Http.get(url.toString()).use(CommonsApplication.createHttpClient()).asResponse();

                    if(response.getStatusLine().getStatusCode() != 204) {
                        allSuccess = false;
                    }
                    Log.d("Commons", "EventLog hit " + url.toString());

                } catch (IOException e) {
                    // Probably just ignore for now. Can be much more robust with a service, etc later on.
                    // But in the interest of debugging
                    throw new RuntimeException(e);
                }

            }

            return allSuccess;
        }
    }

    private static final String DEVICE;
    static {
        if (Build.MODEL.startsWith(Build.MANUFACTURER)) {
            DEVICE = Utils.capitalize(Build.MODEL);
        } else {
            DEVICE = Utils.capitalize(Build.MANUFACTURER) + " " + Build.MODEL;
        }
    }

    public static class LogBuilder {
        private JSONObject data;
        private long rev;
        private String schema;

        private LogBuilder(String schema, long revision) {
            data = new JSONObject();
            this.schema = schema;<commit_msg>EventLogging network failure is silently ignored<commit_after>package org.wikimedia.commons;

import android.os.*;
import android.util.*;
import in.yuvi.http.fluent.Http;
import org.apache.http.HttpResponse;
import org.json.*;
import java.io.IOException;
import java.net.*;

public class EventLog {
    private static class LogTask extends AsyncTask<LogBuilder, Void, Boolean> {

        @Override
        protected Boolean doInBackground(LogBuilder... logBuilders) {

            boolean  allSuccess = true;
            // Not using the default URL connection, since that seems to have different behavior than the rest of the code
            for(LogBuilder logBuilder: logBuilders) {
                HttpURLConnection conn;
                try {

                    URL url = logBuilder.toUrl();
                    HttpResponse response = Http.get(url.toString()).use(CommonsApplication.createHttpClient()).asResponse();

                    if(response.getStatusLine().getStatusCode() != 204) {
                        allSuccess = false;
                    }
                    Log.d("Commons", "EventLog hit " + url.toString());

                } catch (IOException e) {
                    // Probably just ignore for now. Can be much more robust with a service, etc later on.
                    Log.d("Commons", "IO Error, EventLog hit skipped");
                }

            }

            return allSuccess;
        }
    }

    private static final String DEVICE;
    static {
        if (Build.MODEL.startsWith(Build.MANUFACTURER)) {
            DEVICE = Utils.capitalize(Build.MODEL);
        } else {
            DEVICE = Utils.capitalize(Build.MANUFACTURER) + " " + Build.MODEL;
        }
    }

    public static class LogBuilder {
        private JSONObject data;
        private long rev;
        private String schema;

        private LogBuilder(String schema, long revision) {
            data = new JSONObject();
            this.schema = schema;
{'fraction_non_alphanumeric': 0.08835443037974683, 'fraction_numerical': 0.0015189873417721519, 'mean_word_length': 1.856832971800434, 'pattern_counts': {'":': 0, '<': 5, '<?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': '1689975', 'n_tokens_mistral': 1019, 'n_tokens_neox': 956, 'n_words': 283}