output: #fixed code
                               private void writeToLog(String type, String content) {
  		writerThread.execute(()->{
  			String t = ServerTimeUtil.accurateToLogName();
  			File f = new File(logs, t + ".klog");
  			FileWriter fw = null;
  			if (f.exists()) {
  				try {
  					fw = new FileWriter(f, true);
  					fw.write("\r\n\r\nTIME:\r\n" + ServerTimeUtil.accurateToSecond() + "\r\nTYPE:\r\n" + type
  							+ "\r\nCONTENT:\r\n" + content);
  					fw.close();
  				} catch (Exception e1) {
  					if (Printer.instance != null) {
  						Printer.instance.print("KohgylwIFT:[Log]Cannt write to file,message:" + e1.getMessage());
  					} else {
  						System.out.println("KohgylwIFT:[Log]Cannt write to file,message:" + e1.getMessage());
  					}
  				}
  			} else {
  				try {
  					fw = new FileWriter(f, false);
  					fw.write("TIME:\r\n" + ServerTimeUtil.accurateToSecond() + "\r\nTYPE:\r\n" + type + "\r\nCONTENT:\r\n"
  							+ content);
  					fw.close();
  				} catch (IOException e1) {
  					if (Printer.instance != null) {
  						Printer.instance.print("KohgylwIFT:[Log]Cannt write to file,message:" + e1.getMessage());
  					} else {
  						System.out.println("KohgylwIFT:[Log]Cannt write to file,message:" + e1.getMessage());
  					}
  				}
  			}
  		});
  	}
input: #vulnerable code 
                               private void writeToLog(String type, String content) {
  		String t = ServerTimeUtil.accurateToLogName();
  		File f = new File(logs, t + ".klog");
  		FileWriter fw = null;
  		if (f.exists()) {
  			try {
  				fw = new FileWriter(f, true);
  				fw.write("\r\n\r\nTIME:\r\n" + ServerTimeUtil.accurateToSecond() + "\r\nTYPE:\r\n" + type
  						+ "\r\nCONTENT:\r\n" + content);
  				fw.close();
  			} catch (Exception e1) {
  				System.out.println("KohgylwIFT:[Log]Cannt write to file,message:" + e1.getMessage());
  			}
  		} else {
  			try {
  				fw = new FileWriter(f, false);
  				fw.write("TIME:\r\n" + ServerTimeUtil.accurateToSecond() + "\r\nTYPE:\r\n" + type + "\r\nCONTENT:\r\n"
  						+ content);
  				fw.close();
  			} catch (IOException e1) {
  				System.out.println("KohgylwIFT:[Log]Cannt write to file,message:" + e1.getMessage());
  			}
  		}
  	} 
                              #location 20 
                              #vulnerability type RESOURCE_LEAK