Fix bug in logic with enable sql without profile

This commit is contained in:
Ryan Baxter
2022-12-13 09:28:06 -05:00
parent a2c10cc3de
commit 0ffbda6d1d
2 changed files with 2 additions and 1 deletions

View File

@@ -129,7 +129,7 @@ public class JdbcEnvironmentRepository implements EnvironmentRepository, Ordered
try {
Map<String, Object> source;
String name;
if (enableSqlWithoutProfie && profile != null) {
if (!enableSqlWithoutProfie || (enableSqlWithoutProfie && profile != null)) {
source = this.jdbc.query(this.sql, this.extractor, application, profile, label);
name = application + "-" + profile;
}

View File

@@ -187,6 +187,7 @@ public class JdbcEnvironmentRepositoryTests {
@Test
public void testFailOnError() {
JdbcEnvironmentProperties properties = new JdbcEnvironmentProperties();
properties.setEnableSqlWithoutProfile(true);
properties.setSqlWithoutProfile(
"SELECT SHOULD_FAIL from TABLE_NOTEXIST where APPLICATION=? and PROFILE is null and LABEL=?");
JdbcEnvironmentRepository repository = new JdbcEnvironmentRepository(new JdbcTemplate(this.dataSource),