<commit_before>package org.eclipse.che.datasource.api;

import org.eclipse.che.datasource.shared.DriversDTO;
import org.eclipse.che.datasource.shared.ServicePaths;
import org.eclipse.che.dto.server.DtoFactory;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import javax.inject.Singleton;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;
import java.sql.Driver;
import java.sql.DriverManager;
import java.util.ArrayList;
import java.util.Enumeration;
import java.util.List;

import static org.eclipse.che.dto.server.DtoFactory.newDto;

/**
 * A service that lists all available JDBC drivers.
 * @author "<NAME>"
 */
@Path(ServicePaths.DATABASE_TYPES_PATH)
@Singleton
public class AvailableDriversService {
    /** The logger. */
    private static final Logger LOG = LoggerFactory.getLogger(AvailableDriversService.class);
    // try to load all supported drivers
    static {
        try {
            Class.forName("org.postgresql.Driver");
        } catch (ClassNotFoundException e) {
            LOG.debug("postgresql driver not present");
            LOG.trace("postgresql driver not present", e);
        }
        try {
            Class.forName("com.mysql.jdbc.Driver");
        } catch (ClassNotFoundException e) {
            LOG.debug("MySQL driver not present");
            LOG.trace("MySQL driver not present", e);
        }
        try {
            Class.forName("oracle.jdbc.driver.OracleDriver");
        } catch (ClassNotFoundException e) {
            LOG.debug("Oracle driver not present");
            LOG.trace("Oracle driver not present", e);
        }
        try {
            Class.forName("net.sourceforge.jtds.jdbc.Driver");
        } catch (ClassNotFoundException e) {
            LOG.debug("JTDS driver not present");
            LOG.trace("JTDS driver not present", e);
        }
        try {
            Class.forName("com.nuodb.jdbc.Driver");
        } catch (ClassNotFoundException e) {
            LOG.debug("NuoDB driver not present");
            LOG.trace("NuoDB driver not present", e);
        }
    }

    /**
     * Lists all supported JDBC drivers that are present in the classloader.
     *
     * @return the list of drivers
     */

    @GET
    @Produces({MediaType.APPLICATION_JSON, MediaType.TEXT_PLAIN})
    public String getAvailableDatabaseDrivers() {
        final Enumeration<Driver> loadedDrivers = DriverManager.getDrivers();
        final List<String> drivers = new ArrayList<>();
        while (loadedDrivers.hasMoreElements()) {
            Driver driver = loadedDrivers.nextElement();
            drivers.add(driver.getClass().getCanonicalName());
        }
        try{
            newDto(DriversDTO.class).withDrivers(drivers);
            return "ok";
        }catch (Exception ex){
            return ex.getLocalizedMessage();
        }
    }




    public String getAvailableDatabaseDriversT() {
        final Enumeration<Driver> loadedDrivers = DriverManager.getDrivers();<commit_msg>Fixed pom issue<commit_after>package org.eclipse.che.datasource.api;

import org.eclipse.che.datasource.shared.DriversDTO;
import org.eclipse.che.datasource.shared.ServicePaths;
import org.eclipse.che.dto.server.DtoFactory;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import javax.inject.Singleton;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;
import java.sql.Driver;
import java.sql.DriverManager;
import java.util.ArrayList;
import java.util.Enumeration;
import java.util.List;

import static org.eclipse.che.dto.server.DtoFactory.newDto;

/**
 * A service that lists all available JDBC drivers.
 * @author "<NAME>"
 */
@Path(ServicePaths.DATABASE_TYPES_PATH)
@Singleton
public class AvailableDriversService {
    /** The logger. */
    private static final Logger LOG = LoggerFactory.getLogger(AvailableDriversService.class);
    // try to load all supported drivers
    static {
        try {
            Class.forName("org.postgresql.Driver");
        } catch (ClassNotFoundException e) {
            LOG.debug("postgresql driver not present");
            LOG.trace("postgresql driver not present", e);
        }
        try {
            Class.forName("com.mysql.jdbc.Driver");
        } catch (ClassNotFoundException e) {
            LOG.debug("MySQL driver not present");
            LOG.trace("MySQL driver not present", e);
        }
        try {
            Class.forName("oracle.jdbc.driver.OracleDriver");
        } catch (ClassNotFoundException e) {
            LOG.debug("Oracle driver not present");
            LOG.trace("Oracle driver not present", e);
        }
        try {
            Class.forName("net.sourceforge.jtds.jdbc.Driver");
        } catch (ClassNotFoundException e) {
            LOG.debug("JTDS driver not present");
            LOG.trace("JTDS driver not present", e);
        }
        try {
            Class.forName("com.nuodb.jdbc.Driver");
        } catch (ClassNotFoundException e) {
            LOG.debug("NuoDB driver not present");
            LOG.trace("NuoDB driver not present", e);
        }
    }

    /**
     * Lists all supported JDBC drivers that are present in the classloader.
     *
     * @return the list of drivers
     */

    @GET
    @Produces({MediaType.APPLICATION_JSON, MediaType.TEXT_PLAIN})
    public DriversDTO getAvailableDatabaseDrivers() {
        final Enumeration<Driver> loadedDrivers = DriverManager.getDrivers();
        final List<String> drivers = new ArrayList<>();
        while (loadedDrivers.hasMoreElements()) {
            Driver driver = loadedDrivers.nextElement();
            drivers.add(driver.getClass().getCanonicalName());
        }
        return newDto(DriversDTO.class).withDrivers(drivers);
    }




    public String getAvailableDatabaseDriversT() {
        final Enumeration<Driver> loadedDrivers = DriverManager.getDrivers();
{'fraction_non_alphanumeric': 0.11197171240949655, 'fraction_numerical': 0.0006735140596059942, 'mean_word_length': 2.644171779141104, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 13, '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': '1700347', 'n_tokens_mistral': 1736, 'n_tokens_neox': 1685, 'n_words': 370}