<commit_before>package org.hspconsortium.cwfdemo.setup;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.util.List;

import org.apache.commons.io.IOUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.carewebframework.common.StrUtil;
import org.springframework.core.io.Resource;

public class DemoSetup {
    
    private static final Log log = LogFactory.getLog(DemoSetup.class);
    
    public DemoSetup(String connectionUrl, String username, String password, Resource sqlResource) throws Exception {
        
        Class.forName("org.h2.Driver");
        
        try (Connection conn = DriverManager.getConnection(connectionUrl, username, password);) {
            List<String> lines = IOUtils.readLines(sqlResource.getInputStream());
            PreparedStatement ps = conn.prepareStatement(StrUtil.fromList(lines));
            ps.execute();
        } catch (Exception e) {
            log.error("Error during demo setup.  This can occur if setup has already been processed.\n\n" + e.getMessage());
        }
    }
    
}
<commit_msg>Make sure DemoSetup gets executed early.<commit_after>package org.hspconsortium.cwfdemo.setup;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.util.List;

import org.apache.commons.io.IOUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.carewebframework.common.StrUtil;
import org.springframework.beans.BeansException;
import org.springframework.beans.factory.config.BeanPostProcessor;
import org.springframework.core.io.Resource;

public class DemoSetup implements BeanPostProcessor {
    
    private static final Log log = LogFactory.getLog(DemoSetup.class);
    
    public DemoSetup(String connectionUrl, String username, String password, Resource sqlResource) throws Exception {
        
        Class.forName("org.h2.Driver");
        
        try (Connection conn = DriverManager.getConnection(connectionUrl, username, password);) {
            List<String> lines = IOUtils.readLines(sqlResource.getInputStream());
            PreparedStatement ps = conn.prepareStatement(StrUtil.fromList(lines));
            ps.execute();
        } catch (Exception e) {
            log.error("Error during demo setup.  This can occur if setup has already been processed.\n\n" + e.getMessage());
        }
    }
    
    @Override
    public Object postProcessBeforeInitialization(Object bean, String beanName) throws BeansException {
        return bean;
    }
    
    @Override
    public Object postProcessAfterInitialization(Object bean, String beanName) throws BeansException {
        return bean;
    }
    
}

{'fraction_non_alphanumeric': 0.09340064911648034, 'fraction_numerical': 0.000721240533717995, 'mean_word_length': 3.4959481361426255, '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': '425616', 'n_tokens_mistral': 749, 'n_tokens_neox': 751, 'n_words': 175}