<commit_before>package org.orienteer.core.service;

import com.google.common.collect.Lists;
import com.google.inject.*;
import com.google.inject.name.Named;
import com.google.inject.name.Names;
import org.apache.maven.repository.internal.MavenRepositorySystemUtils;
import org.eclipse.aether.DefaultRepositorySystemSession;
import org.eclipse.aether.RepositorySystem;
import org.eclipse.aether.RepositorySystemSession;
import org.eclipse.aether.connector.basic.BasicRepositoryConnectorFactory;
import org.eclipse.aether.impl.DefaultServiceLocator;
import org.eclipse.aether.repository.LocalRepository;
import org.eclipse.aether.repository.RemoteRepository;
import org.eclipse.aether.spi.connector.RepositoryConnectorFactory;
import org.eclipse.aether.spi.connector.transport.TransporterFactory;
import org.eclipse.aether.transport.file.FileTransporterFactory;
import org.eclipse.aether.transport.http.HttpTransporterFactory;
import org.orienteer.core.loader.Dependency;
import org.orienteer.core.loader.MavenResolver;
import org.orienteer.core.loader.OrienteerOutsideModules;
import org.orienteer.core.loader.OrienteerOutsideModulesManager;
import org.orienteer.core.loader.util.ConsoleRepositoryListener;
import org.orienteer.core.loader.util.ConsoleTransferListener;
import org.orienteer.core.loader.util.PomXmlParser;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.List;
import java.util.Map;
import java.util.Properties;
import java.util.Set;

/**
 * @author <NAME>
 */
public class OModuleExecutorInitModule extends AbstractModule {

    private final static Logger LOG = LoggerFactory.getLogger(OModuleExecutorInitModule.class);

    private static final String MAVEN_REMOTE_REPOSITORY      = "orienteer.loader.repository.remote.";
    private static final String MAVEN_REMOTE_REPOSITORY_ID   = "orienteer.loader.repository.remote.%d.id";
    private static final String MAVEN_LOCAL_REPOSITORY       = "orienteer.loader.repository.local";
    private static final String MODULES_FOLDER               = "orienteer.loader.modules.folder";
    private static final String DEFAULT                      = "default";

    private final String defaultModulesFolder             = System.getProperty("user.dir") + "/modules/";
    private final String defaultMavenLocalRepository      = System.getProperty("user.home") + "/.m2/repository/";
    private final String parentPom                        = "../pom.xml";
    private Properties properties;


    @Override
    protected void configure() {
        properties = OrienteerInitModule.retrieveProperties();
        bind(RepositorySystem.class).toProvider(RepositorySystemProvider.class).in(Singleton.class);
        bind(String.class).annotatedWith(Names.named("local-repo")).toProvider(new Provider<String>() {
            @Override
            public String get() {
                String path = properties.getProperty(MAVEN_LOCAL_REPOSITORY);
                return path == null ? defaultMavenLocalRepository : path;
            }
        }).in(Singleton.class);

        bind(DefaultRepositorySystemSessionProvider.class).in(Singleton.class);
        bind(RepositorySystemSession.class).to(DefaultRepositorySystemSession.class);
        bind(DefaultRepositorySystemSession.class)
                .toProvider(DefaultRepositorySystemSessionProvider.class)
                .in(Singleton.class);

        bind(Path.class).annotatedWith(Names.named("outside-modules")).toProvider(new Provider<Path>() {
            @Override
            public Path get() {
                if (properties == null)
                    return Paths.get(defaultModulesFolder);
                String folder = properties.getProperty(MODULES_FOLDER);
                return folder == null ? Paths.get(defaultModulesFolder) : Paths.get(folder);
            }
        });
        bind(OrienteerOutsideModulesManager.class).in(Singleton.class);
        bind(MavenResolver.class).in(Singleton.class);
        requestStaticInjection(OrienteerOutsideModules.class);
    }

    @Singleton
    @Provides @Named("orienteer-default-dependencies")
    private Set<Dependency> orienteerCoreDependenciesProvider(
            @Named("orienteer-versions") Map<String, String> versions) {
        Path corePom = Paths.get( "pom.xml");
        Set<Dependency> coreDependencies = PomXmlParser.readDependencies(corePom, versions);
        Set<Dependency> parentDependencies = PomXmlParser.readDependencies(Paths.get(parentPom));
        parentDependencies.addAll(coreDependencies);
        parentDependencies.add(new Dependency("org.orienteer", "orienteer-core", versions.get("${project.version}")));
        return parentDependencies;
    }
<commit_msg>Change DefaultRepositorySystemSession in non-singleton<commit_after>package org.orienteer.core.service;

import com.google.common.collect.Lists;
import com.google.inject.*;
import com.google.inject.name.Named;
import com.google.inject.name.Names;
import org.apache.maven.repository.internal.MavenRepositorySystemUtils;
import org.eclipse.aether.DefaultRepositorySystemSession;
import org.eclipse.aether.RepositorySystem;
import org.eclipse.aether.RepositorySystemSession;
import org.eclipse.aether.connector.basic.BasicRepositoryConnectorFactory;
import org.eclipse.aether.impl.DefaultServiceLocator;
import org.eclipse.aether.repository.LocalRepository;
import org.eclipse.aether.repository.RemoteRepository;
import org.eclipse.aether.spi.connector.RepositoryConnectorFactory;
import org.eclipse.aether.spi.connector.transport.TransporterFactory;
import org.eclipse.aether.transport.file.FileTransporterFactory;
import org.eclipse.aether.transport.http.HttpTransporterFactory;
import org.orienteer.core.loader.Dependency;
import org.orienteer.core.loader.MavenResolver;
import org.orienteer.core.loader.OrienteerOutsideModules;
import org.orienteer.core.loader.OrienteerOutsideModulesManager;
import org.orienteer.core.loader.util.ConsoleRepositoryListener;
import org.orienteer.core.loader.util.ConsoleTransferListener;
import org.orienteer.core.loader.util.PomXmlParser;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.List;
import java.util.Map;
import java.util.Properties;
import java.util.Set;

/**
 * @author <NAME>
 */
public class OModuleExecutorInitModule extends AbstractModule {

    private final static Logger LOG = LoggerFactory.getLogger(OModuleExecutorInitModule.class);

    private static final String MAVEN_REMOTE_REPOSITORY      = "orienteer.loader.repository.remote.";
    private static final String MAVEN_REMOTE_REPOSITORY_ID   = "orienteer.loader.repository.remote.%d.id";
    private static final String MAVEN_LOCAL_REPOSITORY       = "orienteer.loader.repository.local";
    private static final String DEFAULT                      = "default";
    private static final String MODULES_FOLDER               = "orienteer.loader.modules.folder";

    private final String defaultModulesFolder             = System.getProperty("user.dir") + "/modules/";
    private final String defaultMavenLocalRepository      = System.getProperty("user.home") + "/.m2/repository/";
    private final String parentPom                        = "../pom.xml";
//    private final String parentPom = "pom.xml";
    private Properties properties;


    @Override
    protected void configure() {
        properties = OrienteerInitModule.retrieveProperties();
        bind(RepositorySystem.class).toProvider(RepositorySystemProvider.class).in(Singleton.class);
        bind(String.class).annotatedWith(Names.named("local-repo")).toProvider(new Provider<String>() {
            @Override
            public String get() {
                String path = properties.getProperty(MAVEN_LOCAL_REPOSITORY);
                return path == null ? defaultMavenLocalRepository : path;
            }
        }).in(Singleton.class);

        bind(DefaultRepositorySystemSessionProvider.class).in(Singleton.class);
        bind(RepositorySystemSession.class).to(DefaultRepositorySystemSession.class);
        bind(DefaultRepositorySystemSession.class)
                .toProvider(DefaultRepositorySystemSessionProvider.class);

        bind(Path.class).annotatedWith(Names.named("outside-modules")).toProvider(new Provider<Path>() {
            @Override
            public Path get() {
                if (properties == null)
                    return Paths.get(defaultModulesFolder);
                String folder = properties.getProperty(MODULES_FOLDER);
                return folder == null ? Paths.get(defaultModulesFolder) : Paths.get(folder);
            }
        });
        bind(OrienteerOutsideModulesManager.class).in(Singleton.class);
        bind(MavenResolver.class).in(Singleton.class);
        requestStaticInjection(OrienteerOutsideModules.class);
    }

    @Singleton
    @Provides @Named("orienteer-default-dependencies")
    private Set<Dependency> orienteerCoreDependenciesProvider(
            @Named("orienteer-versions") Map<String, String> versions) {
        Path corePom = Paths.get( "pom.xml");
        Set<Dependency> coreDependencies = PomXmlParser.readDependencies(corePom, versions);
        Set<Dependency> parentDependencies = PomXmlParser.readDependencies(Paths.get(parentPom));
        parentDependencies.addAll(coreDependencies);
        parentDependencies.add(new Dependency("org.orienteer", "orienteer-core", versions.get("${project.version}")));
        return parentDependencies;
    }

{'fraction_non_alphanumeric': 0.1020703933747412, 'fraction_numerical': 0.0006211180124223603, 'mean_word_length': 3.891645569620253, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 17, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 5}, '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': '1377793', 'n_tokens_mistral': 2651, 'n_tokens_neox': 2551, 'n_words': 423}