#vulnerable code 
                                public XmlSuite constructXmlSuiteForDistribution(String pack, List<String> tests,
        Map<String, List<Method>> methods, int deviceCount) {
        try {
            prop.load(new FileInputStream("config.properties"));
        } catch (IOException e) {
            e.printStackTrace();
        }
        include(listeners, "LISTENERS");
        include(groupsInclude, "INCLUDE_GROUPS");
        XmlSuite suite = new XmlSuite();
        suite.setName("TestNG Forum");
        suite.setThreadCount(deviceCount);
        suite.setParallel(ParallelMode.CLASSES);
        suite.setVerbose(2);
        listeners.add("com.appium.manager.AppiumParallelTest");
        listeners.add("com.appium.utils.RetryListener");
        suite.setListeners(listeners);
        if (prop.getProperty("LISTENERS") != null) {
            suite.setListeners(listeners);
        }
        XmlTest test = new XmlTest(suite);
        test.setName("TestNG Test");
        test.addParameter("device", "");
        include(groupsExclude, "EXCLUDE_GROUPS");
        test.setIncludedGroups(groupsInclude);
        test.setExcludedGroups(groupsExclude);
        List<XmlClass> xmlClasses = new ArrayList<>();
        writeXmlClass(tests, methods, xmlClasses);
        test.setXmlClasses(xmlClasses);
        return suite;
    } 
                            #location 4 
                            #vulnerability type RESOURCE_LEAK
#fixed code
                                public XmlSuite constructXmlSuiteForDistribution(String pack, List<String> tests,
        Map<String, List<Method>> methods, int deviceCount) {
        include(listeners, "LISTENERS");
        include(groupsInclude, "INCLUDE_GROUPS");
        XmlSuite suite = new XmlSuite();
        suite.setName("TestNG Forum");
        suite.setThreadCount(deviceCount);
        suite.setParallel(ParallelMode.CLASSES);
        suite.setVerbose(2);
        listeners.add("com.appium.manager.AppiumParallelTest");
        listeners.add("com.appium.utils.RetryListener");
        suite.setListeners(listeners);
        if (prop.getProperty("LISTENERS") != null) {
            suite.setListeners(listeners);
        }
        XmlTest test = new XmlTest(suite);
        test.setName("TestNG Test");
        test.addParameter("device", "");
        include(groupsExclude, "EXCLUDE_GROUPS");
        test.setIncludedGroups(groupsInclude);
        test.setExcludedGroups(groupsExclude);
        List<XmlClass> xmlClasses = new ArrayList<>();
        writeXmlClass(tests, methods, xmlClasses);
        test.setXmlClasses(xmlClasses);
        return suite;
    }