Commit c6d4ff6e authored by Andy Wilkinson's avatar Andy Wilkinson

Merge pull request #19290 from lyyprean

* gh-19290:
  Remove redundant hasText check as query always has text

Closes gh-19290
parents 38340522 c6a18447
...@@ -107,12 +107,10 @@ public class DataSourceHealthIndicator extends AbstractHealthIndicator implement ...@@ -107,12 +107,10 @@ public class DataSourceHealthIndicator extends AbstractHealthIndicator implement
String product = getProduct(); String product = getProduct();
builder.up().withDetail("database", product); builder.up().withDetail("database", product);
String validationQuery = getValidationQuery(product); String validationQuery = getValidationQuery(product);
if (StringUtils.hasText(validationQuery)) { // Avoid calling getObject as it breaks MySQL on Java 7
// Avoid calling getObject as it breaks MySQL on Java 7 List<Object> results = this.jdbcTemplate.query(validationQuery, new SingleColumnRowMapper());
List<Object> results = this.jdbcTemplate.query(validationQuery, new SingleColumnRowMapper()); Object result = DataAccessUtils.requiredSingleResult(results);
Object result = DataAccessUtils.requiredSingleResult(results); builder.withDetail("hello", result);
builder.withDetail("hello", result);
}
} }
private String getProduct() { private String getProduct() {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment