#fixed code
                             public static void writeFileTxt(String fileName, String[] totalFile){
		FileWriter file = null;
	    PrintWriter pw = null;
	    try
	    {
	        file = new FileWriter(System.getProperty("user.dir")+"/"+fileName);
	        pw = new PrintWriter(file);
	
	        for (int i = 0; i < totalFile.length; i++)
	            pw.println(totalFile[i]);
	
	    } catch (Exception e) {
	        e.printStackTrace();
	    } finally {
	       try {
	       // Execute the "finally" to make sure the file is closed
	       if (null != file)
	          file.close();
	       } catch (Exception e2) {
	          e2.printStackTrace();
	       }
			
		   try {
		   	  if (pw != null)
				  pw.close();
		   } catch (Exception e2) {
		      e2.printStackTrace();
		   }
	    }
	}
#vulnerable code 
                             public static void writeFileTxt(String fileName, String[] totalFile){
		FileWriter file = null;
	    PrintWriter pw = null;
	    try
	    {
	        file = new FileWriter(System.getProperty("user.dir")+"/"+fileName);
	        pw = new PrintWriter(file);
	
	        for (int i = 0; i < totalFile.length; i++)
	            pw.println(totalFile[i]);
	
	    } catch (Exception e) {
	        e.printStackTrace();
	    } finally {
	       try {
	       // Execute the "finally" to make sure the file is closed
	       if (null != file)
	          file.close();
	       } catch (Exception e2) {
	          e2.printStackTrace();
	       }
	    }
	} 
                            #location 17 
                            #vulnerability type RESOURCE_LEAK