<commit_before>import org.json.JSONException;
import org.json.JSONObject;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;

/**
 * Created by jman0_000 on 12/24/2015.
 */
public class getProfile {
	public static void getProfile(HttpServletRequest req, HttpServletResponse resp, Connection connection, String id) throws IOException {
		try {
			String select_sql = "SELECT * from Profile where user_id = ?";
			PreparedStatement stmt = connection.prepareStatement(select_sql);
			stmt.setLong(1, Long.parseLong(id));

			ResultSet rs = stmt.executeQuery();
			if (rs.next()) {
				JSONObject profile = new JSONObject();
				profile.put(Constants.NAME ,rs.getString(Constants.NAME));
				profile.put(Constants.ABOUT_ME ,rs.getString(Constants.ABOUT_ME));
				profile.put(Constants.VILLAGE ,rs.getString(Constants.VILLAGE));<commit_msg>Added bad req for getProfile if invalid ID is given.<commit_after>import org.json.JSONException;
import org.json.JSONObject;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;

/**
 * Created by jman0_000 on 12/24/2015.
 */
public class getProfile {
	public static void getProfile(HttpServletRequest req, HttpServletResponse resp, Connection connection, String id) throws IOException {
		try {
			String select_sql = "SELECT * from Profile where user_id = ?";
			PreparedStatement stmt = connection.prepareStatement(select_sql);
			try {
				stmt.setLong(1, Long.parseLong(id));
			}
			catch (NumberFormatException e) {
				resp.setStatus(Constants.BAD_REQUEST);
				return;
			}

			ResultSet rs = stmt.executeQuery();
			if (rs.next()) {
				JSONObject profile = new JSONObject();
				profile.put(Constants.NAME ,rs.getString(Constants.NAME));
				profile.put(Constants.ABOUT_ME ,rs.getString(Constants.ABOUT_ME));
				profile.put(Constants.VILLAGE ,rs.getString(Constants.VILLAGE));
{'fraction_non_alphanumeric': 0.10939627780299592, 'fraction_numerical': 0.011802088061733999, 'mean_word_length': 5.021857923497268, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '1052221', 'n_tokens_mistral': 721, 'n_tokens_neox': 645, 'n_words': 148}