public void write_in_file( String catch_block, String expr_type, String try_con, String all_catch_as_string, String method_content, int log_count, String method_parameter) { // log_count=1; // id++; BufferedWriter bw = null; int logged = 0; if (log_count != 0) { logged = 1; } if (logged == 1) { try { bw = new BufferedWriter(new FileWriter(logged_file_path, true)); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } } else { try { bw = new BufferedWriter(new FileWriter(non_logged_file_path, true)); } catch (IOException e) { e.printStackTrace(); } } // else /* String insert_str= "insert into "+table+" values(\""+package_name+"\",\""+class_name+"\",\""+method_name+"\","+ id+",\""+method_content+"\",\""+ log_levels_combined+"\",\""+temp_file_path+"\","+"\""+if_block+"\",\""+expr_type+"\","+log_count+",\"" +if_train_con+"\","+logged+")"; System.out.println("Insert str"+insert_str); */ try { bw.write("File Path=" + temp_file_path + "\n"); bw.write("Package Name =" + package_name + "\n"); bw.write("class name=" + class_name + "\n"); bw.write("Method Name=" + method_name + "\n"); bw.write("Try Content=" + try_con + "\n"); bw.write(" All Catch Blocks=" + all_catch_as_string + "\n"); bw.write("method parameter = " + method_parameter + "\n"); bw.write("method content=" + method_content + "\n"); bw.write("--------------------\n"); bw.close(); } catch (IOException e) { e.printStackTrace(); } }
public void write_in_file( String if_block, String if_expr, String if_train_con, String method_content, int log_count) { BufferedWriter bw = null; int logged = 0; if (log_count != 0) { logged = 1; } if (logged == 1) { try { bw = new BufferedWriter(new FileWriter(logged_file_path, true)); } catch (IOException e) { e.printStackTrace(); } } else { try { bw = new BufferedWriter(new FileWriter(non_logged_file_path, true)); } catch (IOException e) { e.printStackTrace(); } } // else try { bw.write("File Path=" + temp_file_path + "\n"); bw.write("Package Name =" + package_name + "\n"); bw.write("class name=" + class_name + "\n"); bw.write("Method Name=" + method_name + "\n"); bw.write("If Content=" + if_train_con + "\n"); // bw.write("All Catch Blocks="+ all_catch_as_string+"\n"); // bw.write("method parameter = "+ method_parameter +"\n"); bw.write("method content=" + method_content + "\n"); bw.write("--------------------\n"); bw.close(); } catch (IOException e) { e.printStackTrace(); } }