#vulnerable code 
                                @Test
    public void testJPopulatorFactoryBeanWithCustomRandomizers() {

        ApplicationContext applicationContext =
                new ClassPathXmlApplicationContext("/application-context-with-custom-randomizers.xml");

        Populator populator = (Populator) applicationContext.getBean("populator");

        // the populator managed by spring should be correctly configured
        assertThat(populator).isNotNull();

        // the populator should populate valid instances
        Person person = populator.populateBean(Person.class);

        assertPerson(person);
        System.out.println("person.getEmail() = " + person.getEmail());
        assertThat(person.getEmail())
                .isNotNull()
                .isNotEmpty()
                .contains("@");
    } 
                            #location 7 
                            #vulnerability type RESOURCE_LEAK
#fixed code
                                @Test
    public void testJPopulatorFactoryBeanWithCustomRandomizers() {

        Populator populator = getPopulatorFromSpringContext("/application-context-with-custom-randomizers.xml");

        // the populator managed by spring should be correctly configured
        assertThat(populator).isNotNull();

        // the populator should populate valid instances
        Person person = populator.populateBean(Person.class);

        assertPerson(person);

        assertThat(person.getEmail())
                .isNotNull()
                .isNotEmpty()
                .matches(".*@.*\\..*");
    }