Sonarqube notice a bug while checking the result value from Spring-JDBC "JdbcTemplate.queryForObject()" for null.
After checking the source in deep, we are not sure why sonar thinks that this value can never be null. Even the javadoc tells us that this value could be nullable, and since we expect an object to return, it should be able to be null.
It is also written in the javadoc that the method is able to return null in case:
@return the result object of the required type, or {@code null} in case of SQL NULL
Why can this Integer not be null here ?
The calling method here is JdbcTemplate.java L:802 in Spring-jdbc 5.1.6
Spring JDBC Version 5.1.6
Sonarqube Version 6.7.5