#vulnerable code 
                             public static void main(String[] args)
	{
		try
		{
			String ls_1;
			Process process =null;
			File handle = new File("./tmpdata/ctb/data3");
			BufferedWriter bout = new BufferedWriter(new OutputStreamWriter(
					new FileOutputStream("./tmpdata/malt.train"), "UTF-8"));
			for (File sub : Arrays.asList(handle.listFiles())){
				String str = sub.getAbsolutePath();
				process = Runtime.getRuntime().exec("cmd /c java -jar ./tmpdata/ctb/Penn2Malt.jar "+str+" ./tmpdata/ctb/headrules.txt 3 2 chtb");			
				BufferedReader bufferedReader = new BufferedReader(
					new InputStreamReader(process.getInputStream()));
				while ( (ls_1=bufferedReader.readLine()) != null)
				{
					System.out.println(ls_1);
				}
			}			
		}
		catch(IOException e)
		{
			System.err.println(e);
		}
	} 
                            #location 14 
                            #vulnerability type RESOURCE_LEAK
#fixed code
                             public static void main(String[] args)
	{
		try
		{
			String ls_1;
			Process process =null;
//			File handle = new File("../tmp/ctb_v1/data");
			File handle = new File("../tmp/ctb_v6/data/bracketed");
			
			BufferedWriter bout = new BufferedWriter(new OutputStreamWriter(
					new FileOutputStream("../tmp/malt.train"), "UTF-8"));
			for (File sub : Arrays.asList(handle.listFiles())){
				String file = sub.getAbsolutePath();
				if(!file.endsWith(".fid"))
					continue;
				clean(file);
				process = Runtime.getRuntime().exec("cmd /c java -jar ../tmp/Penn2Malt.jar "+file+" ../tmp/headrules.txt 3 2 chtb");			
				BufferedReader bufferedReader = new BufferedReader(
						new InputStreamReader(process.getInputStream()));
				while ( (ls_1=bufferedReader.readLine()) != null)
				{
					System.out.println(ls_1);
				}
				bufferedReader = new BufferedReader(
						new InputStreamReader(process.getErrorStream()));
				while ( (ls_1=bufferedReader.readLine()) != null)
				{
					System.out.println(ls_1);
				}
			}			
		}
		catch(IOException e)
		{
			System.err.println(e);
		}
	}