title: Dodgy - Redundant nullcheck of value known to be null
body: <p>Below is the code where i am getting the Sonar violation</p>
  
  <pre><code>public static Connection getConnection(
          String db)
          throws SQLException {
  
          Connection connection = null;
  
          try {
              Driver dbRriver = (Driver) Class.forName(driver).newInstance();
              Properties props = new Properties();
              props.put("user", PropertyLoader.get("user123"));
              props.put("password", PropertyLoader.get("pass"));
              connection = dbRriver
                      .connect(PropertyLoader.get("URL"), props);
          } catch (Exception e) {
              **if(connection!= null){
              connection.close();**
              }
              LOGGER.error(IN_EXCEPTION, e);
          }
          return connection;
      }
  </code></pre>
  
  <p>the connection needs to be checked for null condition before closing it,but the sonar is giving the violation as "Dodgy - Redundant nullcheck of value known to be null". Please suggest me as how i can avoid this violation without removing the null check.</p>