#vulnerable code 
                                public static void configureLog(Properties properties) {
        for (String property : properties.stringPropertyNames()) {
            if (property.startsWith(LOGGER_PREFIX)) {
                String classPrefix = getClassPrefix(property);
                AgentLogger.Level level = getLevel(property, properties.getProperty(property));

                if (level != null) {
                    if (classPrefix == null)
                        AgentLogger.setLevel(level);
                    else
                        AgentLogger.setLevel(classPrefix, level);
                }
            } else if (property.equals(LOGFILE)) {
                String logfile = properties.getProperty(LOGFILE);
                try {
                    AgentLogger.getHandler().setPrintStream(new PrintStream(new File(logfile)));
                } catch (FileNotFoundException e) {
                    LOGGER.error("Invalid configuration property {} value '{}'. Unable to create/open the file.",
                            e, LOGFILE, logfile);
                }
            }
        }
    } 
                            #location 16 
                            #vulnerability type RESOURCE_LEAK
#fixed code
                                public static void configureLog(Properties properties) {
        for (String property : properties.stringPropertyNames()) {
            if (property.startsWith(LOGGER_PREFIX)) {
                String classPrefix = getClassPrefix(property);
                AgentLogger.Level level = getLevel(property, properties.getProperty(property));

                if (level != null) {
                    if (classPrefix == null)
                        AgentLogger.setLevel(level);
                    else
                        AgentLogger.setLevel(classPrefix, level);
                }
            } else if (property.equals(LOGFILE)) {
                String logfile = properties.getProperty(LOGFILE);
                boolean append = parseBoolean(properties.getProperty(LOGFILE_APPEND, "false"));
                try {
                PrintStream ps = new PrintStream(new FileOutputStream(new File(logfile), append));
                	AgentLogger.getHandler().setPrintStream(ps);
                } catch (FileNotFoundException e) {
                    LOGGER.error("Invalid configuration property {} value '{}'. Unable to create/open the file.",
                            e, LOGFILE, logfile);
                }
            }
        }
    }