<commit_before>package edu.emory.cci.aiw.cvrg.eureka.servlet;

import java.io.IOException;
import java.security.KeyManagementException;
import java.security.NoSuchAlgorithmException;
import java.security.cert.CertificateException;
import java.security.cert.X509Certificate;

import javax.net.ssl.SSLContext;
import javax.net.ssl.TrustManager;
import javax.net.ssl.X509TrustManager;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.ws.rs.core.MediaType;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import com.sun.jersey.api.client.Client;
import com.sun.jersey.api.client.ClientResponse;
import com.sun.jersey.api.client.WebResource;
import com.sun.jersey.api.client.config.ClientConfig;
import com.sun.jersey.api.client.config.DefaultClientConfig;
import com.sun.jersey.client.urlconnection.HTTPSProperties;

import edu.emory.cci.aiw.cvrg.eureka.common.comm.UserRequest;

public class RegisterUserServlet extends HttpServlet {

	private static Logger LOGGER = LoggerFactory.getLogger(RegisterUserServlet.class);
	
	@Override
	protected void doPost(HttpServletRequest req, HttpServletResponse resp)
			throws ServletException, IOException {
		doGet(req, resp);
	}
	
	@Override
	public void doGet(HttpServletRequest req, HttpServletResponse resp)
			throws ServletException, IOException {

		Client c;
		try {
			c = this.getClient();

			String eurekaServicesUrl = req.getSession().getServletContext()
					.getInitParameter("eureka-services-url");

			WebResource webResource = c.resource(eurekaServicesUrl);

			String email 		= req.getParameter("email");
			String verifyEmail 	= req.getParameter("verifyEmail");
			String firstName 	= req.getParameter("firstName");
			String lastName 	= req.getParameter("lastName");
			String organziation = req.getParameter("organization");
			String password 	= req.getParameter("password");
			String verifyPassword = req.getParameter("verifyPassword");

			UserRequest userRequest = new UserRequest();
			userRequest.setFirstName(firstName);
			userRequest.setLastName(lastName);
			userRequest.setEmail(email);
			userRequest.setVerifyEmail(verifyEmail);
			userRequest.setOrganization(organziation);
			userRequest.setVerifyPassword(verifyPassword);
			userRequest.setPassword(password);

			ClientResponse response = webResource.path("/api/user/add")
					.type(MediaType.APPLICATION_JSON)
					.accept(MediaType.TEXT_PLAIN)
					.post(ClientResponse.class, userRequest);
			
			int status = response.getClientResponseStatus().getStatusCode();
			if (status < HttpServletResponse.SC_BAD_REQUEST) {
				resp.setStatus(status);				
				resp.getWriter().close();
			} else {
				resp.setContentType("text/plain");
				String msg = response.getEntity(String.class);
				LOGGER.debug("Error: {}", msg);
				resp.setStatus(status);
				resp.setContentLength(msg.length());
				resp.getWriter().write(msg);
				resp.getWriter().close();
			}
			

		} catch (KeyManagementException e) {
			e.printStackTrace();
		} catch (NoSuchAlgorithmException e) {
			e.printStackTrace();
		}
	}

	private Client getClient() throws KeyManagementException,
			NoSuchAlgorithmException {
		TrustManager trustManager = new X509TrustManager() {

			@Override
			public X509Certificate[] getAcceptedIssuers() {
				return null;
			}

			@Override
			public void checkServerTrusted(X509Certificate[] inArg0,
					String inArg1) throws CertificateException {
				// nothing todo
			}

			@Override
			public void checkClientTrusted(X509Certificate[] inArg0,
					String inArg1) throws CertificateException {
				// nothing to do
			}
		};
		ClientConfig clientConfig = new DefaultClientConfig();
		SSLContext sslContext = SSLContext.getInstance("SSLv3");
		sslContext.init(null, new TrustManager[] { trustManager }, null);
		clientConfig.getProperties().put(
				HTTPSProperties.PROPERTY_HTTPS_PROPERTIES,
				new HTTPSProperties(null, sslContext));
		return new Client().create(clientConfig);
	}
}<commit_msg>Replaced custom Jersey client set up code with the standard CommUtils.getClient() call.  This will fix an issue with the registration process failing due to "no body writer" Jersey errors.<commit_after>package edu.emory.cci.aiw.cvrg.eureka.servlet;

import java.io.IOException;
import java.security.KeyManagementException;
import java.security.NoSuchAlgorithmException;
import java.security.cert.CertificateException;
import java.security.cert.X509Certificate;

import javax.net.ssl.SSLContext;
import javax.net.ssl.TrustManager;
import javax.net.ssl.X509TrustManager;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.ws.rs.core.MediaType;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import com.sun.jersey.api.client.Client;
import com.sun.jersey.api.client.ClientResponse;
import com.sun.jersey.api.client.WebResource;
import com.sun.jersey.api.client.config.ClientConfig;
import com.sun.jersey.api.client.config.DefaultClientConfig;
import com.sun.jersey.client.urlconnection.HTTPSProperties;

import edu.emory.cci.aiw.cvrg.eureka.common.comm.CommUtils;
import edu.emory.cci.aiw.cvrg.eureka.common.comm.UserRequest;

public class RegisterUserServlet extends HttpServlet {

	private static Logger LOGGER = LoggerFactory.getLogger(RegisterUserServlet.class);
	
	@Override
	protected void doPost(HttpServletRequest req, HttpServletResponse resp)
			throws ServletException, IOException {
		doGet(req, resp);
	}
	
	@Override
	public void doGet(HttpServletRequest req, HttpServletResponse resp)
			throws ServletException, IOException {

		Client c;
		try {
			c = CommUtils.getClient();

			String eurekaServicesUrl = req.getSession().getServletContext()
					.getInitParameter("eureka-services-url");

			WebResource webResource = c.resource(eurekaServicesUrl);

			String email 		= req.getParameter("email");
			String verifyEmail 	= req.getParameter("verifyEmail");
			String firstName 	= req.getParameter("firstName");
			String lastName 	= req.getParameter("lastName");
			String organziation = req.getParameter("organization");
			String password 	= req.getParameter("password");
			String verifyPassword = req.getParameter("verifyPassword");

			UserRequest userRequest = new UserRequest();
			userRequest.setFirstName(firstName);
			userRequest.setLastName(lastName);
			userRequest.setEmail(email);
			userRequest.setVerifyEmail(verifyEmail);
			userRequest.setOrganization(organziation);
			userRequest.setVerifyPassword(<PASSWORD>Password);
			userRequest.setPassword(password);

			ClientResponse response = webResource.path("/api/user/add")
					.type(MediaType.APPLICATION_JSON)
					.accept(MediaType.TEXT_PLAIN)
					.post(ClientResponse.class, userRequest);
			
			int status = response.getClientResponseStatus().getStatusCode();
			if (status < HttpServletResponse.SC_BAD_REQUEST) {
				resp.setStatus(status);				
				resp.getWriter().close();
			} else {
				resp.setContentType("text/plain");
				String msg = response.getEntity(String.class);
				LOGGER.debug("Error: {}", msg);
				resp.setStatus(status);
				resp.setContentLength(msg.length());
				resp.getWriter().write(msg);
				resp.getWriter().close();
			}
			

		} catch (KeyManagementException e) {
			e.printStackTrace();
		} catch (NoSuchAlgorithmException e) {
			e.printStackTrace();
		}
	}
}
{'fraction_non_alphanumeric': 0.10900852878464819, 'fraction_numerical': 0.004397654584221748, 'mean_word_length': 5.018444266238974, 'pattern_counts': {'":': 0, '<': 6, '<?xml version=': 0, '>': 4, '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': '4377912', 'n_tokens_mistral': 2514, 'n_tokens_neox': 2196, 'n_words': 401}