<commit_before>package iou.controller;

import iou.enums.TransactionType;
import iou.model.Payment;
import iou.model.Transaction;
import org.apache.commons.dbcp.BasicDataSource;
import org.apache.log4j.Logger;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

import java.util.List;

public class ControllerImpl implements IController {

    private ApplicationContext springContext;

    private static final String SPRING_CONFIG = "iou/controller/applicationContext.xml";

    private static final Logger LOGGER = Logger.getLogger(ControllerImpl.class);

    private ITransactionDao dao;

    public boolean login(String username, String password) {

        // Create the application context,
        springContext = new ClassPathXmlApplicationContext(SPRING_CONFIG);
        dao = (ITransactionDao) springContext.getBean("txnDao");

        // Set the username and password, then try and login
        BasicDataSource dataSource = (BasicDataSource) springContext.getBean("dataSource");
        dataSource.setUsername(username);
        dataSource.setPassword(password);

        try {
            dao.testConnection();
        } catch (Exception ex) {
            LOGGER.error("DB connection test failed", ex);
            return false;
        }

        LOGGER.debug("Connection successfully tested");
        return true;
    }

    public List<Transaction> getTransactions(TransactionType type) {
        return dao.getTransactions(type);
    }

    public Transaction insertTransaction(Transaction tran) {
        return dao.insertTransaction(tran);
    }

    public boolean updateTransaction(Transaction tran) {<commit_msg>fixed loading of Spring XML file<commit_after>package iou.controller;

import iou.enums.TransactionType;
import iou.model.Payment;
import iou.model.Transaction;
import org.apache.commons.dbcp.BasicDataSource;
import org.apache.log4j.Logger;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

import java.util.List;

public class ControllerImpl implements IController {

    private static final Logger LOGGER = Logger.getLogger(ControllerImpl.class);

    private ITransactionDao dao;

    public boolean login(String username, String password) {

        // Create the application context,
        ApplicationContext springContext = new ClassPathXmlApplicationContext("/applicationContext.xml");
        dao = (ITransactionDao) springContext.getBean("txnDao");

        // Set the username and password, then try and login
        BasicDataSource dataSource = (BasicDataSource) springContext.getBean("dataSource");
        dataSource.setUsername(username);
        dataSource.setPassword(password);

        try {
            dao.testConnection();
        } catch (Exception ex) {
            LOGGER.error("DB connection test failed", ex);
            return false;
        }

        LOGGER.debug("Connection successfully tested");
        return true;
    }

    public List<Transaction> getTransactions(TransactionType type) {
        return dao.getTransactions(type);
    }

    public Transaction insertTransaction(Transaction tran) {
        return dao.insertTransaction(tran);
    }

    public boolean updateTransaction(Transaction tran) {
{'fraction_non_alphanumeric': 0.08136404427161233, 'fraction_numerical': 0.0005982650314089142, 'mean_word_length': 3.5934065934065935, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 2}, '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': '7480257', 'n_tokens_mistral': 840, 'n_tokens_neox': 822, 'n_words': 207}