#fixed code
                                @Test
    public void testScriptString() throws Exception {
        File file = tmpDir.newFile();
        String line = "hello world";
        executeMojo.scripts = new String[] { "new File('" + file.getAbsolutePath().replaceAll("\\\\", "/") + "').withWriter { w -> w << '" + line +"' }" };

        executeMojo.execute();
        BufferedReader reader = new BufferedReader(new FileReader(file));
        LineReader lineReader = new LineReader(reader);
        String actualLine = lineReader.readLine();
        reader.close();

        Assert.assertEquals(line, actualLine);
    }
#vulnerable code 
                                @Test
    public void testScriptString() throws Exception {
        File file = tmpDir.newFile();
        String line = "hello world";
        executeMojo.scripts = new String[] { "new File('" + file.getAbsolutePath().replaceAll("\\\\", "/") + "').withWriter { w -> w << '" + line +"' }" };

        executeMojo.execute();

        LineReader lineReader = new LineReader(new BufferedReader(new FileReader(file)));
        String actualLine = lineReader.readLine();
        Assert.assertEquals(line, actualLine);
    } 
                            #location 9 
                            #vulnerability type RESOURCE_LEAK