#vulnerable code 
                                @Test
    public void testCreate() throws SQLException
    {
        HikariConfig config = new HikariConfig();
        config.setMinimumIdle(1);
        config.setMaximumPoolSize(1);
        config.setInitializationFailFast(true);
        config.setConnectionTestQuery("VALUES 1");
        config.setDataSourceClassName("com.zaxxer.hikari.mocks.StubDataSource");

        HikariDataSource ds = new HikariDataSource(config);
        try
        {
            Assert.assertSame("Totals connections not as expected", 1, TestElf.getPool(ds).getTotalConnections());
            Assert.assertSame("Idle connections not as expected", 1, TestElf.getPool(ds).getIdleConnections());
    
            Connection connection = ds.getConnection();
            Assert.assertNotNull(connection);
    
            Assert.assertSame("Totals connections not as expected", 1, TestElf.getPool(ds).getTotalConnections());
            Assert.assertSame("Idle connections not as expected", 0, TestElf.getPool(ds).getIdleConnections());
    
            PreparedStatement statement = connection.prepareStatement("SELECT * FROM device WHERE device_id=?");
            Assert.assertNotNull(statement);
    
            statement.setInt(1, 0);
    
            ResultSet resultSet = statement.executeQuery();
            Assert.assertNotNull(resultSet);
    
            Assert.assertFalse(resultSet.next());
    
            resultSet.close();
            statement.close();
            connection.close();
    
            Assert.assertSame("Totals connections not as expected", 1, TestElf.getPool(ds).getTotalConnections());
            Assert.assertSame("Idle connections not as expected", 1, TestElf.getPool(ds).getIdleConnections());
        }
        finally
        {
            ds.shutdown();
        }
    } 
                            #location 42 
                            #vulnerability type RESOURCE_LEAK
#fixed code
                                @Test
    public void testCreate() throws SQLException
    {
        HikariConfig config = new HikariConfig();
        config.setMinimumIdle(1);
        config.setMaximumPoolSize(1);
        config.setInitializationFailFast(true);
        config.setConnectionTestQuery("VALUES 1");
        config.setDataSourceClassName("com.zaxxer.hikari.mocks.StubDataSource");

        HikariDataSource ds = new HikariDataSource(config);
        try
        {
            Assert.assertSame("Totals connections not as expected", 1, TestElf.getPool(ds).getTotalConnections());
            Assert.assertSame("Idle connections not as expected", 1, TestElf.getPool(ds).getIdleConnections());
    
            Connection connection = ds.getConnection();
            Assert.assertNotNull(connection);
    
            Assert.assertSame("Totals connections not as expected", 1, TestElf.getPool(ds).getTotalConnections());
            Assert.assertSame("Idle connections not as expected", 0, TestElf.getPool(ds).getIdleConnections());
    
            PreparedStatement statement = connection.prepareStatement("SELECT * FROM device WHERE device_id=?");
            Assert.assertNotNull(statement);
    
            statement.setInt(1, 0);
    
            ResultSet resultSet = statement.executeQuery();
            Assert.assertNotNull(resultSet);
    
            Assert.assertFalse(resultSet.next());
    
            resultSet.close();
            statement.close();
            connection.close();
    
            Assert.assertSame("Totals connections not as expected", 1, TestElf.getPool(ds).getTotalConnections());
            Assert.assertSame("Idle connections not as expected", 1, TestElf.getPool(ds).getIdleConnections());
        }
        finally
        {
            ds.close();
        }
    }