<commit_before>package com.bt4vt.external.bt4u;

import com.bt4vt.R;
import com.google.inject.Inject;
import com.google.inject.Singleton;

import org.json.JSONArray;
import org.json.JSONException;
import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
import org.jsoup.nodes.Element;
import org.jsoup.select.Elements;

import java.io.IOException;
import java.util.ArrayList;
import java.util.List;

import okhttp3.Call;
import okhttp3.Request;
import okhttp3.Response;
import roboguice.inject.InjectResource;

/**
 * Service to get current route information
 *
 * @author <NAME>
 */
@Singleton
public class RouteService {

  @InjectResource(R.string.bt4u_base_url)
  private String BT4U_BASE_URL;

  String BT4U_ROUTE_URL = BT4U_BASE_URL + "routes";

  @Inject
  private HttpClient client;

  @Inject
  private Request.Builder requestBuilder;

  public void getAll(final Callback<List<Route>> callback) {
    Request request = requestBuilder
        .url(BT4U_ROUTE_URL)
        .build();

    client.newCall(request).enqueue(new okhttp3.Callback() {
      @Override
      public void onFailure(Call call, IOException e) {
        callback.onException(e);
      }

      @Override
      public void onResponse(Call call, Response response) throws IOException {
        try {
          int statusCode = response.code();
          if (statusCode == 200) {
            String stringBody = response.body().string();
            String routeListString = new JSONArray(stringBody).getJSONObject(0).getString("routeListHtml");
            Document document = Jsoup.parse(routeListString);
            Elements elements = document.getElementsByClass("list-group-item");
            List<Route> routes = new ArrayList<>();
            for (Element el : elements) {
              routes.add(Route.valueOf(el));
            }
            callback.onResult(routes);
          }
        } catch (JSONException e) {
          callback.onException(e);
        }
      }
    });
  }
}<commit_msg>Handle non-200 status for getting all routes<commit_after>package com.bt4vt.external.bt4u;

import com.bt4vt.R;
import com.google.inject.Inject;
import com.google.inject.Singleton;

import org.json.JSONArray;
import org.json.JSONException;
import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
import org.jsoup.nodes.Element;
import org.jsoup.select.Elements;

import java.io.IOException;
import java.util.ArrayList;
import java.util.List;

import okhttp3.Call;
import okhttp3.Request;
import okhttp3.Response;
import roboguice.inject.InjectResource;

/**
 * Service to get current route information
 *
 * @author <NAME>
 */
@Singleton
public class RouteService {

  @InjectResource(R.string.bt4u_base_url)
  private String BT4U_BASE_URL;

  String BT4U_ROUTE_URL = BT4U_BASE_URL + "routes";

  @Inject
  private HttpClient client;

  @Inject
  private Request.Builder requestBuilder;

  public void getAll(final Callback<List<Route>> callback) {
    Request request = requestBuilder
        .url(BT4U_ROUTE_URL)
        .build();

    client.newCall(request).enqueue(new okhttp3.Callback() {
      @Override
      public void onFailure(Call call, IOException e) {
        callback.onException(e);
      }

      @Override
      public void onResponse(Call call, Response response) throws IOException {
        try {
          int statusCode = response.code();
          if (statusCode == 200) {
          String stringBody = response.body().string();
            String routeListString = new JSONArray(stringBody).getJSONObject(0).getString("routeListHtml");
            Document document = Jsoup.parse(routeListString);
            Elements elements = document.getElementsByClass("list-group-item");
            List<Route> routes = new ArrayList<>();
            for (Element el : elements) {
              routes.add(Route.valueOf(el));
            }
            callback.onResult(routes);
          } else {
            callback.onFail(statusCode, stringBody);
          }
        } catch (JSONException e) {
          callback.onException(e);
        }
      }
    });
  }
}
{'fraction_non_alphanumeric': 0.10528905289052891, 'fraction_numerical': 0.008610086100861008, 'mean_word_length': 2.939922480620155, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 13, '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': '6125165', 'n_tokens_mistral': 1203, 'n_tokens_neox': 1197, 'n_words': 259}