Source:
private DataSource open(final SitePaths site, final Config cfg, final Context context, final DataSourceType dst) { ConfigSection dbs = new ConfigSection(cfg, "database"); String driver = dbs.optional("driver"); if (Strings.isNullOrEmpty(driver)) { driver = dst.getDriver(); } String url = dbs.optional("url"); if (Strings.isNullOrEmpty(url)) { url = dst.getUrl(); } String username = dbs.optional("username"); String password = dbs.optional("password"); String interceptor = dbs.optional("dataSourceInterceptorClass"); boolean usePool; if (context == Context.SINGLE_USER) { usePool = false; } else { usePool = cfg.getBoolean("database", "connectionpool", dst.usePool()); } if (usePool) { final BasicDataSource ds = new BasicDataSource(); ds.setDriverClassName(driver); ds.setUrl(url); if (username != null && !username.isEmpty()) { ds.setUsername(username); } if (password != null && !password.isEmpty()) { ds.setPassword(password); } ds.setMaxActive(cfg.getInt("database", "poollimit", DEFAULT_POOL_LIMIT)); ds.setMinIdle(cfg.getInt("database", "poolminidle", 4)); ds.setMaxIdle(cfg.getInt("database", "poolmaxidle", 4)); ds.setMaxWait(ConfigUtil.getTimeUnit(cfg, "database", null, "poolmaxwait", MILLISECONDS.convert(30, SECONDS), MILLISECONDS)); ds.setInitialSize(ds.getMinIdle()); return intercept(interceptor, ds); } else { try { final Properties p = new Properties(); p.setProperty("driver", driver); p.setProperty("url", url); if (username != null) { p.setProperty("user", username); } if (password != null) { secureStore.set("database", null, "password", password); } return intercept(interceptor, new SimpleDataSource(p)); } catch (SQLException se) { throw new ProvisionException("Database unavailable", se); } } }

Target:
private DataSource open(final SitePaths site, final Config cfg, final Context context, final DataSourceType dst) { ConfigSection dbs = new ConfigSection(cfg, "database"); String driver = dbs.optional("driver"); if (Strings.isNullOrEmpty(driver)) { driver = dst.getDriver(); } String url = dbs.optional("url"); if (Strings.isNullOrEmpty(url)) { url = dst.getUrl(); } String username = dbs.optional("username"); String password = dbs.optional("password"); String interceptor = dbs.optional("dataSourceInterceptorClass"); boolean usePool; if (context == Context.SINGLE_USER) { usePool = false; } else { usePool = cfg.getBoolean("database", "connectionpool", dst.usePool()); } if (usePool) { final BasicDataSource ds = new BasicDataSource(); ds.setDriverClassName(driver); ds.setUrl(url); if (username != null && !username.isEmpty()) { ds.setUsername(username); } if (password != null && !password.isEmpty()) { ds.setPassword(password); } ds.setMaxActive(cfg.getInt("database", "poollimit", DEFAULT_POOL_LIMIT)); ds.setMinIdle(cfg.getInt("database", "poolminidle", 4)); ds.setMaxIdle(cfg.getInt("database", "poolmaxidle", 4)); ds.setMaxWait(ConfigUtil.getTimeUnit(cfg, "database", null, "poolmaxwait", MILLISECONDS.convert(30, SECONDS), MILLISECONDS)); ds.setInitialSize(ds.getMinIdle()); return intercept(interceptor, ds); } else { try { final Properties p = new Properties(); p.setProperty("driver", driver); p.setProperty("url", url); if (username != null) { p.setProperty("user", username); } if (password != null) { p.setProperty("password", password); } return intercept(interceptor, new SimpleDataSource(p)); } catch (SQLException se) { throw new ProvisionException("Database unavailable", se); } } }