title: Method may fail to clean up stream or resource on checked exception -- FindBugs
body: <p>I am using Spring JDBCTemplate to access data in database and its working fine. But FindBugs is pointing me a Minor issue in my code snippet. </p>
  
  <p><strong>CODE:</strong></p>
  
  <pre><code>public String createUser(final User user) {
          try { 
              final String insertQuery = "insert into user (id, username, firstname, lastname) values (?, ?, ?, ?)";
              KeyHolder keyHolder = new GeneratedKeyHolder();
              jdbcTemplate.update(new PreparedStatementCreator() {
                  public PreparedStatement createPreparedStatement(Connection connection) throws SQLException {
                      PreparedStatement ps = connection.prepareStatement(insertQuery, new String[] { "id" });
                      ps.setInt(1, user.getUserId());
                      ps.setString(2, user.getUserName());
                      ps.setString(3, user.getFirstName());
                      ps.setInt(4, user.getLastName());
                      return ps;
                  }
              }, keyHolder);
              int userId = keyHolder.getKey().intValue();
              return "user created successfully with user id: " + userId;
          } catch (DataAccessException e) {
              log.error(e, e);
          }
      }
  </code></pre>
  
  <p><strong>FindBugs Issue:</strong></p>
  
  <p>Method may fail to clean up stream or resource on checked exception in this line <code>PreparedStatement ps = connection.prepareStatement(insertQuery, new String[] { "id" });</code></p>
  
  <p>Could some one please brief me what is this exactly? And how can we solve this?</p>
  
  <p>Help would be appreciated :)</p>