<commit_before>package xdi2.connect.example.ra.connect;

import java.net.URI;

import javax.servlet.ServletContext;

import xdi2.connect.core.ConnectRequest;
import xdi2.core.impl.memory.MemoryGraphFactory;
import xdi2.core.syntax.CloudName;
import xdi2.messaging.MessageEnvelope;

public class ConnectRequests {

	public static ConnectRequest ACMENEWS_CONNECT_REQUEST = null;
	public static ConnectRequest ACMEPIZZA_CONNECT_REQUEST = null;

	public static ConnectRequest acmenewsConnectRequest(ServletContext servletContext) {

		if (ACMENEWS_CONNECT_REQUEST == null) {

			try {

				String baseReturnUri = servletContext.getInitParameter("baseReturnUri");

				ACMENEWS_CONNECT_REQUEST = ConnectRequest.fromMessageEnvelope(MessageEnvelope.fromGraph(MemoryGraphFactory.getInstance().loadGraph(ConnectRequests.class.getResourceAsStream("/acmenews.message.xdi"))));
				ACMENEWS_CONNECT_REQUEST.sign(CloudName.create("+acmenews"), "acmenews");
				ACMENEWS_CONNECT_REQUEST.setReturnUri(URI.create(baseReturnUri + "acmenews-return"));
			} catch (Exception ex) {

				throw new RuntimeException(ex.getMessage(), ex);
			}
		}

		return ACMENEWS_CONNECT_REQUEST;
	}

	public static ConnectRequest acmepizzaConnectRequest(ServletContext servletContext) {

		if (ACMEPIZZA_CONNECT_REQUEST == null) {

			try {

				String baseReturnUri = servletContext.getInitParameter("baseReturnUri");

				ACMEPIZZA_CONNECT_REQUEST = ConnectRequest.fromMessageEnvelope(MessageEnvelope.fromGraph(MemoryGraphFactory.getInstance().loadGraph(ConnectRequests.class.getResourceAsStream("/acmepizza.message.xdi"))));
				ACMEPIZZA_CONNECT_REQUEST.sign(CloudName.create("+acmepizza"), "acmepizza");
				ACMEPIZZA_CONNECT_REQUEST.setReturnUri(URI.create(baseReturnUri + "acmepizza-return"));
			} catch (Exception ex) {
<commit_msg>set connect requests to null on error<commit_after>package xdi2.connect.example.ra.connect;

import java.net.URI;

import javax.servlet.ServletContext;

import xdi2.connect.core.ConnectRequest;
import xdi2.core.impl.memory.MemoryGraphFactory;
import xdi2.core.syntax.CloudName;
import xdi2.messaging.MessageEnvelope;

public class ConnectRequests {

	public static ConnectRequest ACMENEWS_CONNECT_REQUEST = null;
	public static ConnectRequest ACMEPIZZA_CONNECT_REQUEST = null;

	public static ConnectRequest acmenewsConnectRequest(ServletContext servletContext) {

		if (ACMENEWS_CONNECT_REQUEST == null) {

			try {

				String baseReturnUri = servletContext.getInitParameter("baseReturnUri");

				ACMENEWS_CONNECT_REQUEST = ConnectRequest.fromMessageEnvelope(MessageEnvelope.fromGraph(MemoryGraphFactory.getInstance().loadGraph(ConnectRequests.class.getResourceAsStream("/acmenews.message.xdi"))));
				ACMENEWS_CONNECT_REQUEST.sign(CloudName.create("+acmenews"), "acmenews");
				ACMENEWS_CONNECT_REQUEST.setReturnUri(URI.create(baseReturnUri + "acmenews-return"));
			} catch (Exception ex) {

				ACMENEWS_CONNECT_REQUEST = null;
				throw new RuntimeException(ex.getMessage(), ex);
			}
		}

		return ACMENEWS_CONNECT_REQUEST;
	}

	public static ConnectRequest acmepizzaConnectRequest(ServletContext servletContext) {

		if (ACMEPIZZA_CONNECT_REQUEST == null) {

			try {

				String baseReturnUri = servletContext.getInitParameter("baseReturnUri");

				ACMEPIZZA_CONNECT_REQUEST = ConnectRequest.fromMessageEnvelope(MessageEnvelope.fromGraph(MemoryGraphFactory.getInstance().loadGraph(ConnectRequests.class.getResourceAsStream("/acmepizza.message.xdi"))));
				ACMEPIZZA_CONNECT_REQUEST.sign(CloudName.create("+acmepizza"), "acmepizza");
				ACMEPIZZA_CONNECT_REQUEST.setReturnUri(URI.create(baseReturnUri + "acmepizza-return"));
			} catch (Exception ex) {

				ACMEPIZZA_CONNECT_REQUEST = null;
{'fraction_non_alphanumeric': 0.09808676906494207, 'fraction_numerical': 0.0026946914578280788, 'mean_word_length': 6.6853002070393375, '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': '3316025', 'n_tokens_mistral': 1259, 'n_tokens_neox': 1150, 'n_words': 160}