Skip to content

Commit c6a1844

Browse files
lyypreanwilkinsona
authored andcommitted
Remove redundant hasText check as query always has text
See gh-19290
1 parent 3834052 commit c6a1844

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/jdbc/DataSourceHealthIndicator.java

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -107,12 +107,10 @@ private void doDataSourceHealthCheck(Health.Builder builder) throws Exception {
107107
String product = getProduct();
108108
builder.up().withDetail("database", product);
109109
String validationQuery = getValidationQuery(product);
110-
if (StringUtils.hasText(validationQuery)) {
111-
// Avoid calling getObject as it breaks MySQL on Java 7
112-
List<Object> results = this.jdbcTemplate.query(validationQuery, new SingleColumnRowMapper());
113-
Object result = DataAccessUtils.requiredSingleResult(results);
114-
builder.withDetail("hello", result);
115-
}
110+
// Avoid calling getObject as it breaks MySQL on Java 7
111+
List<Object> results = this.jdbcTemplate.query(validationQuery, new SingleColumnRowMapper());
112+
Object result = DataAccessUtils.requiredSingleResult(results);
113+
builder.withDetail("hello", result);
116114
}
117115

118116
private String getProduct() {

0 commit comments

Comments
 (0)