#vulnerable code 
                                private HashSet<String> extractOutputVariables(String stateMachineText) throws IOException {
        InputStream is = new ByteArrayInputStream(stateMachineText.getBytes());
        BufferedReader bReader = new BufferedReader(new InputStreamReader(is));

        HashSet<String> outputVars = new HashSet<String>();
        String line = bReader.readLine();
        while (line != null) {
            if (line.contains("var_out")) {
                int startIndex = line.indexOf("var_out");
                int lastIndex = startIndex;
                while (lastIndex < line.length() && (Character.isLetter(line.charAt(lastIndex))
                        || Character.isDigit(line.charAt(lastIndex))
                        || line.charAt(lastIndex) == '_'
                        || line.charAt(lastIndex) == '-')) {
                    lastIndex++;
                }
                if (lastIndex == line.length()) {
                    throw new IOException("Reached the end of the line while parsing variable name in line: '" + line
                            + "'.");
                }
                String varName = line.substring(startIndex, lastIndex);
                log.info("Found variable: " + varName);
                outputVars.add(varName);
            }
            line = bReader.readLine();
        }

        return outputVars;
    } 
                            #location 18 
                            #vulnerability type RESOURCE_LEAK
#fixed code
                                private HashSet<String> extractOutputVariables(String stateMachineText) throws IOException {
        Set<String> names = ScXmlUtils.getAttributesValues(stateMachineText, "assign", "name");
        return (HashSet<String>) names;
    }