// Path: dbpatch-core/src/main/java/org/jsoftware/dbpatch/impl/CloseUtil.java
// public class CloseUtil {
// 
//     private CloseUtil() {
//     }
// 
//     public static void close(Closeable closeable) {
//         try {
//             if (closeable != null) {
//                 closeable.close();
//             }
//         } catch (Exception e) {	/* findBugs ok */ }
//     }
// 
//     public static void close(Statement statement) {
//         try {
//             if (statement != null) {
//                 statement.close();
//             }
//         } catch (Exception e) {	/* findBugs ok */ }
//     }
// 
//     public static void close(Connection conn) {
//         try {
//             if (conn != null) {
//                 conn.close();
//             }
//         } catch (Exception e) {	/* findBugs ok */ }
//     }
// 
//     public static void close(ResultSet rs) {
//         try {
//             if (rs != null) {
//                 rs.close();
//             }
//         } catch (Exception e) {	/* findBugs ok */ }
//     }
// 
// }
// 
// Path: dbpatch-core/src/main/java/org/jsoftware/dbpatch/log/Log.java
// public interface Log {
// 
//     void trace(String msg, Throwable e);
// 
//     void debug(String msg);
// 
//     void info(String msg);
// 
//     void warn(String msg);
// 
//     void fatal(String msg);
// 
//     void warn(String msg, Throwable e);
// 
//     void fatal(String msg, Throwable e);
// }


import org.jsoftware.dbpatch.impl.CloseUtil;
import org.jsoftware.dbpatch.log.Log;
import org.jsoftware.dbpatch.log.LogFactory;
import java.io.*;
import java.text.ParseException;
import java.util.Collection;
        final Log log = LogFactory.getInstance();
        InputStream input = null;
        File baseDir = null;
        try {
            if (confFile == null) {
                log.debug("Looking for dbpach.properties in classpath.");
                input = Thread.currentThread().getContextClassLoader().getResourceAsStream("/dbpatch.properties");
                log.debug("Resource dbpatch.properties " + (input == null ? "not" : "") + " found in classpath.");
                if (input == null) {
                    log.debug("Looking for dbpach.properties in current directory.");
                    File f = new File("dbpatch.properties");
                    log.debug("Resource dbpatch.properties " + (!f.exists() ? "not" : "") + " found in current directory.");
                    input = new FileInputStream(f);
                    baseDir = new File(".");
                }
            } else {
                if (!confFile.exists()) {
                    throw new FileNotFoundException(confFile.getAbsolutePath());
                }
                log.debug("Configuration found - " + confFile.getPath());
                input = new FileInputStream(confFile);
                baseDir = confFile.getParentFile();
            }
            AbstractConfigurationParser parser = new PropertiesConfigurationParser();
            Collection<ConfigurationEntry> conf = parser.parse(baseDir, input);
            for (ConfigurationEntry ce : conf) {
                ce.validate();
            }
            return conf;
        } finally {
// Path: dbpatch-core/src/main/java/org/jsoftware/dbpatch/impl/CloseUtil.java
// public class CloseUtil {
// 
//     private CloseUtil() {
//     }
// 
//     public static void close(Closeable closeable) {
//         try {
//             if (closeable != null) {
//                 closeable.close();
//             }
//         } catch (Exception e) {	/* findBugs ok */ }
//     }
// 
//     public static void close(Statement statement) {
//         try {
//             if (statement != null) {
//                 statement.close();
//             }
//         } catch (Exception e) {	/* findBugs ok */ }
//     }
// 
//     public static void close(Connection conn) {
//         try {
//             if (conn != null) {
//                 conn.close();
//             }
//         } catch (Exception e) {	/* findBugs ok */ }
//     }
// 
//     public static void close(ResultSet rs) {
//         try {
//             if (rs != null) {
//                 rs.close();
//             }
//         } catch (Exception e) {	/* findBugs ok */ }
//     }
// 
// }
// 
// Path: dbpatch-core/src/main/java/org/jsoftware/dbpatch/log/Log.java
// public interface Log {
// 
//     void trace(String msg, Throwable e);
// 
//     void debug(String msg);
// 
//     void info(String msg);
// 
//     void warn(String msg);
// 
//     void fatal(String msg);
// 
//     void warn(String msg, Throwable e);
// 
//     void fatal(String msg, Throwable e);
// }


// Path: dbpatch-core/src/main/java/org/jsoftware/dbpatch/config/AbstractConfigurationParser.java
import org.jsoftware.dbpatch.impl.CloseUtil;
import org.jsoftware.dbpatch.log.Log;
import org.jsoftware.dbpatch.log.LogFactory;
import java.io.*;
import java.text.ParseException;
import java.util.Collection;

        final Log log = LogFactory.getInstance();
        InputStream input = null;
        File baseDir = null;
        try {
            if (confFile == null) {
                log.debug("Looking for dbpach.properties in classpath.");
                input = Thread.currentThread().getContextClassLoader().getResourceAsStream("/dbpatch.properties");
                log.debug("Resource dbpatch.properties " + (input == null ? "not" : "") + " found in classpath.");
                if (input == null) {
                    log.debug("Looking for dbpach.properties in current directory.");
                    File f = new File("dbpatch.properties");
                    log.debug("Resource dbpatch.properties " + (!f.exists() ? "not" : "") + " found in current directory.");
                    input = new FileInputStream(f);
                    baseDir = new File(".");
                }
            } else {
                if (!confFile.exists()) {
                    throw new FileNotFoundException(confFile.getAbsolutePath());
                }
                log.debug("Configuration found - " + confFile.getPath());
                input = new FileInputStream(confFile);
                baseDir = confFile.getParentFile();
            }
            AbstractConfigurationParser parser = new PropertiesConfigurationParser();
            Collection<ConfigurationEntry> conf = parser.parse(baseDir, input);
            for (ConfigurationEntry ce : conf) {
                ce.validate();
            }
            return conf;
        } finally {
            CloseUtil.close(input);