<commit_before>/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package com.gruposet.ecommerce.daos;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
import java.util.Properties;
import java.util.logging.Level;
import java.util.logging.Logger;

/**
 *
 * @author thiagomessias
 */
public class Database {
    private Connection connection = null;
    private String databaseUrl = "jdbc:mysql://localhost:3306/ecommerce";
    private String user = "root";
    private String psw = "root";
    
    public Database() {
        Properties properties = new Properties();
        properties.put("user", user);
        properties.put("password", <PASSWORD>);
        try {
            connection = DriverManager.getConnection(databaseUrl, properties);
        } catch (SQLException ex) {
            Logger.getLogger(Database.class.getName()).log(Level.SEVERE, null, ex);
        }
    }

    public Connection getConnection() {
        return connection;
    }
    
    public void closeConnection() {
        if (connection != null) {
            try {
                connection.close();
            } catch (SQLException ex) {
                Logger.getLogger(Database.class.getName()).log(Level.SEVERE, null, ex);
            }
        }
    }
    
}
<commit_msg>Modificação da classe Database para não criar uma conexão com o banco quando for iniciada<commit_after>/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package com.gruposet.ecommerce.daos;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
import java.util.Properties;
import java.util.logging.Level;
import java.util.logging.Logger;

/**
 *
 * @author thiagomessias
 */
public class Database {
    private Connection connection = null;
    private String databaseUrl = "jdbc:mysql://localhost:3306/ecommerce";
    private String user = "root";
    private String psw = "root";
    
    private Connection createConnection() {
        Properties properties = new Properties();
        properties.put("user", user);
        properties.put("password", <PASSWORD>);
        
        try {
            connection = DriverManager.getConnection(databaseUrl, properties);
        } catch (SQLException ex) {
            Logger.getLogger(Database.class.getName()).log(Level.SEVERE, null, ex);
        }
        return connection;
    }
    
    // TODO: Error validations
    public Connection getConnection() {
        if (connection == null) {
            return this.createConnection();
        }
        return connection;
    }
    
    public void closeConnection() {
        if (connection != null) {
            try {
                connection.close();
            } catch (SQLException ex) {
                Logger.getLogger(Database.class.getName()).log(Level.SEVERE, null, ex);
            }
        }
    }
    
}

{'fraction_non_alphanumeric': 0.1053303542930099, 'fraction_numerical': 0.0025534631343759975, 'mean_word_length': 2.505592841163311, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '3955920', 'n_tokens_mistral': 835, 'n_tokens_neox': 824, 'n_words': 227}