コード例 #1
0
  public void insert(
      String if_block,
      String if_expr,
      String method_if_between_con,
      int loc_till_if,
      int is_till_if_logged,
      int till_if_log_count,
      String till_if_log_levels,
      String operators_till_if,
      int operators_count_till_if,
      String variables_till_if,
      int variables_count_till_if,
      String method_call_names_till_if,
      int method_call_count_till_if,
      int is_return_till_if,
      int throw_throws_till_if,
      int if_in_till_if,
      int if_count_in_till_if,
      int is_assert_till_if,
      int is_method_have_param,
      String method_param_as_string_original,
      String method_param_as_string,
      String method_param_type,
      String method_param_name,
      int method_param_count,
      int is_return_in_if,
      int throw_throws_if,
      int is_assert_if,
      int is_null_condition_if,
      int is_instance_of_condition_if,
      String package_name,
      String class_name,
      String method_name,
      String file_path,
      int is_if_logged,
      int if_log_count,
      String if_log_levels) {

    id++;
    //  int logged= 0;

    /*if(log_count!=0)
    {
    	logged =1;
    }*/

    util_met utm = new util_met();
    method_if_between_con = utm.replace_quotes_string(method_if_between_con);
    if_block = utm.replace_quotes_string(if_block);

    method_if_between_con = "I am not inserting too large for if";
    if_block = "too large not inserting if block";

    if_expr = utm.replace_quotes_string(if_expr);
    file_path = file_path.replace("\\", "\\\\");

    String insert_str =
        " insert into "
            + table
            + " values("
            + id
            + ",'"
            + if_block
            + "','"
            + if_expr
            + "','"
            + method_if_between_con
            + "',"
            + loc_till_if
            + ","
            + is_till_if_logged
            + ","
            + till_if_log_count
            + ",'"
            + till_if_log_levels
            + "','"
            + operators_till_if
            + "',"
            + operators_count_till_if
            + ",'"
            + variables_till_if
            + "',"
            + variables_count_till_if
            + ",'"
            + method_call_names_till_if
            + "',"
            + method_call_count_till_if
            + ","
            + is_return_till_if
            + ","
            + throw_throws_till_if
            + ","
            + if_in_till_if
            + ","
            + if_count_in_till_if
            + ","
            + is_assert_till_if
            + ","
            + is_method_have_param
            + ",'"
            + method_param_as_string_original
            + "','"
            + method_param_as_string
            + "','"
            + method_param_type
            + "','"
            + method_param_name
            + "',"
            + method_param_count
            + ","
            + is_return_in_if
            + ","
            + throw_throws_if
            + ","
            + is_assert_if
            + ","
            + is_null_condition_if
            + ","
            + is_instance_of_condition_if
            + ",'"
            + package_name
            + "','"
            + class_name
            + "','"
            + method_name
            + "', '"
            + file_path
            + "',"
            + is_if_logged
            + ","
            + if_log_count
            + ",'"
            + if_log_levels
            + "'"
            + " )";

    System.out.println("Insert str" + insert_str);
    try {
      if (conn == null) {
        // System.out.println("I am null");
      }
      stmt = conn.createStatement();
      stmt.executeUpdate(insert_str);
    } catch (SQLException e) { // TODO Auto-generated catch block
      e.printStackTrace();
    }
  }
コード例 #2
0
  public void write_in_db(
      int try_id,
      int catch_id,
      String try_con,
      String catch_con,
      String method_try_between_con,
      String catch_exception,
      String previous_catch_con,
      String file_path,
      String package_name,
      String class_name,
      String method_name,
      int try_loc,
      int is_try_logged,
      int try_log_count,
      String try_log_levels,
      int is_catch_logged,
      int catch_log_count,
      String catch_log_levels,
      int have_previous_catches,
      int previous_catches_logged,
      int is_return_in_try,
      int is_return_in_catch,
      int is_catch_object_ignore,
      int is_interrupted_exception,
      int is_thread_sleep_try,
      int throw_throws_try,
      int throw_throws_catch,
      int if_in_try,
      int if_count_in_try,
      int is_assert_try,
      int is_assert_catch,
      int previous_catches_log_count,
      int catch_depth,
      int is_method_have_param,
      String method_param_as_string_original,
      String method_param_as_string,
      String method_param_type,
      String method_param_name,
      int method_param_count,
      String method_call_names_try,
      int method_call_count_try,
      String operators_in_try,
      int operators_count_try,
      String variables_in_try,
      int variables_count_try,
      String method_call_names_till_try,
      int method_call_count_till_try,
      String operators_till_try,
      int operators_count_till_try,
      String variables_till_try,
      int varaibles_count_till_try,
      int loc_till_try,
      int is_till_try_logged,
      int till_try_log_count,
      String till_try_log_levels,
      int is_return_till_try,
      int throw_throws_till_try,
      int if_in_till_try,
      int if_count_in_till_try,
      int is_assert_till_try) {

    util_met utm = new util_met();
    // method_content = utm.replace_quotes_string(method_content);
    method_try_between_con = utm.replace_quotes_string(method_try_between_con);

    try_con = utm.replace_quotes_string(try_con);
    catch_con = utm.replace_quotes_string(catch_con);

    String insert_str =
        "insert into "
            + table
            + " values("
            + try_id
            + ","
            + catch_id
            + ",\""
            + try_con
            + "\",\""
            + catch_con
            + "\",\""
            + method_try_between_con
            + "\",\""
            + catch_exception
            + "\",\""
            + previous_catch_con
            + "\",\""
            + file_path
            + "\",\""
            + package_name
            + "\",\""
            + class_name
            + "\",\""
            + method_name
            + "\","
            + try_loc
            + ","
            + is_try_logged
            + ","
            + try_log_count
            + ",\""
            + try_log_levels
            + "\","
            + is_catch_logged
            + ","
            + catch_log_count
            + ",\""
            + catch_log_levels
            + "\","
            + have_previous_catches
            + ","
            + previous_catches_logged
            + ","
            + is_return_in_try
            + ","
            + is_return_in_catch
            + ","
            + is_catch_object_ignore
            + ","
            + is_interrupted_exception
            + ","
            + is_thread_sleep_try
            + ","
            + throw_throws_try
            + ","
            + throw_throws_catch
            + ","
            + if_in_try
            + ","
            + if_count_in_try
            + ","
            + is_assert_try
            + ","
            + is_assert_catch
            + ","
            + previous_catches_log_count
            + ","
            + catch_depth
            + ","
            + is_method_have_param
            + ",\""
            + method_param_as_string_original
            + "\",\""
            + method_param_as_string
            + "\",\""
            + method_param_type
            + "\",\""
            + method_param_name
            + "\","
            + method_param_count
            + ",\""
            + method_call_names_try
            + "\","
            + method_call_count_try
            + ",'"
            + operators_in_try
            + "',"
            + operators_count_try
            + ",'"
            + variables_in_try
            + "',"
            + variables_count_try
            + ",'"
            + method_call_names_till_try
            + "',"
            + method_call_count_till_try
            + ",'"
            + operators_till_try
            + "',"
            + operators_count_till_try
            + ",'"
            + variables_till_try
            + "',"
            + varaibles_count_till_try
            + ","
            + loc_till_try
            + ","
            + is_till_try_logged
            + ","
            + till_try_log_count
            + ",\""
            + till_try_log_levels
            + "\","
            + is_return_till_try
            + ","
            + throw_throws_till_try
            + ","
            + if_in_till_try
            + ","
            + if_count_in_till_try
            + ","
            + is_assert_till_try
            + ")";

    System.out.println("Insert str=" + insert_str);
    System.out.println("Try id=" + try_id);

    /*if("ajp".equalsIgnoreCase(package_name))
    {
    	System.out.println("Hi for ajp:"+ package_name);
    	//interupt();

    }*/
    try {

      System.out.println("I am writing");
      stmt = conn.createStatement();
      stmt.executeUpdate(insert_str);
    } catch (SQLException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
    }
  }