<commit_before>package edu.ncsu.dlf.servlet;

import java.io.IOException;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.eclipse.egit.github.core.Repository;
import org.eclipse.egit.github.core.client.GitHubClient;
import org.eclipse.egit.github.core.service.RepositoryService;
import org.json.JSONArray;

import java.util.Date;
import java.util.Map;
import java.util.TreeMap;

public class RepositoriesServlet extends HttpServlet {
	private static final long serialVersionUID = 1L;
	@Override
	protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
		GitHubClient client = new GitHubClient();
		client.setOAuth2Token(req.getParameter("access_token"));

		TreeMap<Date, String> sortedRepos = new TreeMap<Date, String>();
		RepositoryService service = new RepositoryService(client);
		for (Repository repo : service.getRepositories()) {
			sortedRepos.put(repo.getUpdatedAt(), repo.getName());
		}

		JSONArray reposJSON = new JSONArray();
		for(Map.Entry<Date, String> entry : sortedRepos.entrySet()) {
			// Date key = entry.getKey();
			// String value = entry.getValue();
			// System.out.println("key is: "+ key + " & Value is: " + value);
			
			reposJSON.put(entry.getValue());
		}
		// System.out.println(reposJSON);
		resp.setContentType("application/json");
		resp.getWriter().write(reposJSON.toString());
	}

}<commit_msg>returning list of branches in repositories json (/repositories path)<commit_after>package edu.ncsu.dlf.servlet;

import java.io.IOException;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.eclipse.egit.github.core.Repository;
import org.eclipse.egit.github.core.RepositoryBranch;
import org.eclipse.egit.github.core.client.GitHubClient;
import org.eclipse.egit.github.core.service.RepositoryService;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;

import java.util.Date;
import java.util.Map;
import java.util.TreeMap;

public class RepositoriesServlet extends HttpServlet {
	private static final long serialVersionUID = 1L;
	@Override
	protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
		GitHubClient client = new GitHubClient();
		client.setOAuth2Token(req.getParameter("access_token"));

		TreeMap<Date, Repository> sortedRepos = new TreeMap<Date, Repository>();
		RepositoryService service = new RepositoryService(client);
		for (Repository repo : service.getRepositories()) {
			sortedRepos.put(repo.getUpdatedAt(), repo);
		}

		JSONArray reposJSON = new JSONArray();
		for(Map.Entry<Date, Repository> entry : sortedRepos.entrySet()) {
			// Date key = entry.getKey();
			// String value = entry.getValue();
			// System.out.println("key is: "+ key + " & Value is: " + value);
			
			
			JSONArray branchArray = new JSONArray();
			for(RepositoryBranch branch: service.getBranches(entry.getValue())){
				branchArray.put(branch.getName());
			}

			JSONObject repoJSON;
			try {
				repoJSON = new JSONObject().put("repoName", entry.getValue().getName()).put("branches", branchArray);
				reposJSON.put(repoJSON);
			} catch (JSONException e) {
				e.printStackTrace();
			}
		}
		// System.out.println(reposJSON);
		resp.setContentType("application/json");
		resp.getWriter().write(reposJSON.toString());
	}

}
{'fraction_non_alphanumeric': 0.12527964205816555, 'fraction_numerical': 0.0011185682326621924, 'mean_word_length': 5.125, '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': '7318934', 'n_tokens_mistral': 1148, 'n_tokens_neox': 1055, 'n_words': 218}