nus-yam/ex-repair huggingface dataset:
Program: 116858
Project: 116858
Buggy source:
public static Xot_invk_mock new_(byte defn_tid,int idx_adj,byte[] frame_ttl,Keyval... args){
  Xot_invk_mock rv=new Xot_invk_mock(defn_tid,idx_adj,frame_ttl);
  int len=args.length;
  for (int i=0; i < len; i++) {
    Keyval kv=args[i];
    String kv_key_str=kv.Key();
    Object kv_key_obj=kv.Key_as_obj();
    Arg_nde_tkn_mock nde_tkn=null;
    if (Type_.Eq_by_obj(kv_key_obj,Int_.Cls_ref_type))     nde_tkn=new Arg_nde_tkn_mock(null,kv.Val_to_str_or_empty());
 else     if (Type_.Eq_by_obj(kv.Val(),Bool_.Cls_ref_type)) {
      boolean kv_val_bool=Bool_.Cast(kv.Val());
      if (kv_val_bool)       nde_tkn=new Arg_nde_tkn_mock(kv_key_str,"String_Node_Str");
 else       continue;
    }
 else     nde_tkn=new Arg_nde_tkn_mock(kv_key_str,kv.Val_to_str_or_empty());
    rv.args.Add_if_dupe_use_nth(Bry_.new_u8(kv_key_str),nde_tkn);
  }
  return rv;
}

Fixed version (ground truth):
public static Xot_invk_mock new_(byte defn_tid,int idx_adj,byte[] frame_ttl,Keyval... args){
  Xot_invk_mock rv=new Xot_invk_mock(defn_tid,idx_adj,frame_ttl);
  int len=args.length;
  for (int i=0; i < len; i++) {
    Keyval kv=args[i];
    if (kv == null)     continue;
    String kv_key_str=kv.Key();
    Object kv_key_obj=kv.Key_as_obj();
    Arg_nde_tkn_mock nde_tkn=null;
    if (Type_.Eq_by_obj(kv_key_obj,Int_.Cls_ref_type))     nde_tkn=new Arg_nde_tkn_mock(null,kv.Val_to_str_or_empty());
 else     if (Type_.Eq_by_obj(kv.Val(),Bool_.Cls_ref_type)) {
      boolean kv_val_bool=Bool_.Cast(kv.Val());
      if (kv_val_bool)       nde_tkn=new Arg_nde_tkn_mock(kv_key_str,"String_Node_Str");
 else       continue;
    }
 else     nde_tkn=new Arg_nde_tkn_mock(kv_key_str,kv.Val_to_str_or_empty());
    rv.args.Add_if_dupe_use_nth(Bry_.new_u8(kv_key_str),nde_tkn);
  }
  return rv;
}
Program: 116859
Project: 116859
Buggy source:
private void Bld_kv_ary(Bry_bfr bfr,Keyval[] ary){
  int len=ary.length;
  bfr.Add_str_a7("String_Node_Str").Add_int_variable(len).Add_str_a7("String_Node_Str");
  for (int i=0; i < len; i++) {
    Keyval kv=ary[i];
    Bld_obj(bfr,kv.Key_as_obj());
    Bld_obj(bfr,kv.Val());
  }
  bfr.Add_byte(Byte_ascii.Curly_end);
}

Fixed version (ground truth):
private void Bld_kv_ary(Bry_bfr bfr,Keyval[] ary){
  int len=ary.length;
  bfr.Add_str_a7("String_Node_Str").Add_int_variable(len).Add_str_a7("String_Node_Str");
  for (int i=0; i < len; i++) {
    Keyval kv=ary[i];
    if (kv == null) {
      Bld_obj(bfr,gplx.langs.phps.Php_srl_parser.NULL_ARRAY_ITEM);
    }
 else {
      Bld_obj(bfr,kv.Key_as_obj());
      Bld_obj(bfr,kv.Val());
    }
  }
  bfr.Add_byte(Byte_ascii.Curly_end);
}
Program: 116860
Project: 116860
Buggy source:
public int compare(Object lhsObj,Object rhsObj){
  Keyval lhs=(Keyval)lhsObj;
  Keyval rhs=(Keyval)rhsObj;
  Object lhs_key=lhs.Key_as_obj();
  Object rhs_key=rhs.Key_as_obj();
  boolean lhs_is_int=Type_.Eq(lhs_key.getClass(),Int_.Cls_ref_type);
  boolean rhs_is_int=Type_.Eq(rhs_key.getClass(),Int_.Cls_ref_type);
  if (lhs_is_int != rhs_is_int)   return lhs_is_int ? CompareAble_.Less : CompareAble_.More;
  if (lhs_is_int)   return Int_.Compare(Int_.Cast(lhs_key),Int_.Cast(rhs_key));
 else   return String_.Compare(String_.cast(lhs_key),String_.cast(rhs_key));
}

Fixed version (ground truth):
public int compare(Object lhsObj,Object rhsObj){
  Keyval lhs=(Keyval)lhsObj;
  Keyval rhs=(Keyval)rhsObj;
  if (lhs == null && rhs == null)   return CompareAble_.Same;
 else   if (lhs == null)   return CompareAble_.More;
 else   if (rhs == null)   return CompareAble_.Less;
  Object lhs_key=lhs.Key_as_obj();
  Object rhs_key=rhs.Key_as_obj();
  boolean lhs_is_int=Type_.Eq(lhs_key.getClass(),Int_.Cls_ref_type);
  boolean rhs_is_int=Type_.Eq(rhs_key.getClass(),Int_.Cls_ref_type);
  if (lhs_is_int != rhs_is_int)   return lhs_is_int ? CompareAble_.Less : CompareAble_.More;
  if (lhs_is_int)   return Int_.Compare(Int_.Cast(lhs_key),Int_.Cast(rhs_key));
 else   return String_.Compare(String_.cast(lhs_key),String_.cast(rhs_key));
}
Program: 116861
Project: 116861
Buggy source:
public static byte[] Mid_safe(byte[] src,int bgn,int end){
  if (src == null)   return null;
  int src_len=src.length;
  if (bgn < 0)   bgn=0;
  if (end >= src_len)   end=src_len;
  if (bgn > end)   bgn=end;
 else   if (end < bgn)   end=bgn;
  return Mid(src,bgn,end);
}

Fixed version (ground truth):
public static byte[] Mid_safe(byte[] src,int bgn,int end){
  if (src == null)   return null;
  int src_len=src.length;
  if (bgn < 0)   bgn=0;
 else   if (bgn >= src_len)   bgn=src_len;
  if (end < 0)   end=0;
 else   if (end >= src_len)   end=src_len;
  if (bgn > end)   bgn=end;
 else   if (end < bgn)   end=bgn;
  return Mid(src,bgn,end);
}
Program: 116862
Project: 116862
Buggy source:
private static void Ary__to_str__nest(Bry_bfr bfr,int indent,Keyval[] ary){
  int len=ary.length;
  for (int i=0; i < len; ++i) {
    Keyval itm=ary[i];
    if (indent > 0)     bfr.Add_byte_repeat(Byte_ascii.Space,indent * 2);
    bfr.Add_str_u8(Object_.Xto_str_strict_or_empty(itm.Key())).Add_byte_eq();
    Object val=itm.Val();
    if (val == null)     bfr.Add_str_a7(String_.Null_mark);
 else {
      Class<?> val_type=Type_.Type_by_obj(val);
      if (Type_.Eq(val_type,Keyval[].class)) {
        bfr.Add_byte_nl();
        Ary__to_str__nest(bfr,indent + 1,(Keyval[])val);
        continue;
      }
 else       if (Type_.Eq(val_type,Bool_.Cls_ref_type)) {
        boolean val_as_bool=Bool_.Cast(val);
        bfr.Add(val_as_bool ? Bool_.True_bry : Bool_.False_bry);
      }
 else       bfr.Add_str_u8(Object_.Xto_str_strict_or_null_mark(val));
    }
    bfr.Add_byte_nl();
  }
}

Fixed version (ground truth):
public static String Ary__to_str__nest(Keyval... ary){
  Bry_bfr bfr=Bry_bfr_.New();
  Ary__to_str__nest__obj(bfr,0,true,ary);
  return bfr.To_str_and_clear();
}
Program: 116863
Project: 116863
Buggy source:
public Xow_xtn_mgr Ctor_by_app(Xoae_app app){
  Add(app,new Cite_xtn_mgr());
  Add(app,new Imap_xtn_mgr());
  Add(app,new Sites_xtn_mgr());
  Add(app,new Insider_xtn_mgr());
  Add(app,new Indicator_xtn_mgr());
  Add(app,new Pp_xtn_mgr());
  Add(app,new Wdata_xtn_mgr());
  Add(app,new Pgbnr_xtn_mgr());
  Add(app,new gplx.xowa.xtns.scribunto.Scrib_xtn_mgr());
  Add(app,new gplx.xowa.xtns.gallery.Gallery_xtn_mgr());
  Add(app,new gplx.xowa.xtns.poems.Poem_xtn_mgr());
  Add(app,new gplx.xowa.xtns.hieros.Hiero_xtn_mgr());
  Add(app,new gplx.xowa.xtns.scores.Score_xtn_mgr());
  Add(app,new gplx.xowa.xtns.listings.Listing_xtn_mgr());
  Add(app,new gplx.xowa.xtns.titleBlacklists.Blacklist_xtn_mgr());
  Add(app,new gplx.xowa.xtns.pfuncs.scribunto.Pfunc_xtn_mgr());
  Add(app,new gplx.xowa.xtns.flaggedRevs.Flagged_revs_xtn_mgr());
  return this;
}

Fixed version (ground truth):
public Xow_xtn_mgr Ctor_by_app(Xoae_app app){
  Add(app,new Cite_xtn_mgr());
  Add(app,new Imap_xtn_mgr());
  Add(app,new Sites_xtn_mgr());
  Add(app,new Insider_xtn_mgr());
  Add(app,new Indicator_xtn_mgr());
  Add(app,new Pp_xtn_mgr());
  Add(app,new Wdata_xtn_mgr());
  Add(app,new Pgbnr_xtn_mgr());
  Add(app,new gplx.xowa.xtns.scribunto.Scrib_xtn_mgr());
  Add(app,new gplx.xowa.xtns.gallery.Gallery_xtn_mgr());
  Add(app,new gplx.xowa.xtns.poems.Poem_xtn_mgr());
  Add(app,new gplx.xowa.xtns.hieros.Hiero_xtn_mgr());
  Add(app,new gplx.xowa.xtns.scores.Score_xtn_mgr());
  Add(app,new gplx.xowa.xtns.listings.Listing_xtn_mgr());
  Add(app,new gplx.xowa.xtns.titleBlacklists.Blacklist_xtn_mgr());
  Add(app,new gplx.xowa.xtns.pfuncs.scribunto.Pfunc_xtn_mgr());
  Add(app,new gplx.xowa.xtns.flaggedRevs.Flagged_revs_xtn_mgr());
  Add(app,new gplx.xowa.xtns.jsonConfigs.scribunto.Jscfg_xtn_mgr());
  return this;
}
Program: 116864
Project: 116864
Buggy source:
public static LuaValue Obj_to_lua_val(Luaj_server server,Object o){
  if (o == null)   return LuaValue.NIL;
  Class<?> c=Type_.Type_by_obj(o);
  if (Object_.Eq(c,Bool_.Cls_ref_type))   return LuaValue.valueOf((Boolean)o);
 else   if (Object_.Eq(c,Byte_.Cls_ref_type))   return LuaValue.valueOf((Byte)o);
 else   if (Object_.Eq(c,Int_.Cls_ref_type))   return LuaValue.valueOf((Integer)o);
 else   if (Object_.Eq(c,String_.Cls_ref_type))   return LuaValue.valueOf((String)o);
 else   if (Object_.Eq(c,Double_.Cls_ref_type))   return LuaValue.valueOf((Double)o);
 else   if (Object_.Eq(c,byte[].class))   return LuaValue.valueOf(String_.new_u8((byte[])o));
 else   if (Object_.Eq(c,Keyval.class))   return Kv_ary_to_lua_tbl(server,(Keyval)o);
 else   if (Object_.Eq(c,Keyval[].class))   return Kv_ary_to_lua_tbl(server,(Keyval[])o);
 else   if (Object_.Eq(c,Long_.Cls_ref_type))   return LuaValue.valueOf((Long)o);
 else   if (Object_.Eq(c,Scrib_lua_proc.class))   return server.Get_closure_by_id(((Scrib_lua_proc)o).Id());
 else   if (Object_.Eq(c,Float_.Cls_ref_type))   return LuaValue.valueOf((Float)o);
 else   if (Object_.Eq(c,Char_.Cls_ref_type))   return LuaValue.valueOf((Character)o);
 else   if (Object_.Eq(c,Short_.Cls_ref_type))   return LuaValue.valueOf((Short)o);
 else   if (Object_.Eq(c,Decimal_adp.class))   return LuaValue.valueOf(((Decimal_adp)o).To_double());
 else   return LuaValue.NIL;
}

Fixed version (ground truth):
public static LuaValue Obj_to_lua_val(Luaj_server server,Object o){
  if (o == null)   return LuaValue.NIL;
  Class<?> c=Type_.Type_by_obj(o);
  if (Object_.Eq(c,Bool_.Cls_ref_type))   return LuaValue.valueOf((Boolean)o);
 else   if (Object_.Eq(c,Byte_.Cls_ref_type))   return LuaValue.valueOf((Byte)o);
 else   if (Object_.Eq(c,Int_.Cls_ref_type))   return LuaValue.valueOf((Integer)o);
 else   if (Object_.Eq(c,String_.Cls_ref_type))   return LuaValue.valueOf((String)o);
 else   if (Object_.Eq(c,Double_.Cls_ref_type))   return LuaValue.valueOf((Double)o);
 else   if (Object_.Eq(c,byte[].class))   return LuaValue.valueOf(String_.new_u8((byte[])o));
 else   if (Object_.Eq(c,Keyval.class))   return Make_lua_tbl_by_kv_ary(server,(Keyval)o);
 else   if (Object_.Eq(c,Keyval[].class))   return Make_lua_tbl_by_kv_ary(server,(Keyval[])o);
 else   if (Object_.Eq(c,Object[].class))   return Make_lua_tbl_by_obj_ary(server,((Object[])o));
 else   if (Object_.Eq(c,Long_.Cls_ref_type))   return LuaValue.valueOf((Long)o);
 else   if (Object_.Eq(c,Scrib_lua_proc.class))   return server.Get_closure_by_id(((Scrib_lua_proc)o).Id());
 else   if (Object_.Eq(c,Float_.Cls_ref_type))   return LuaValue.valueOf((Float)o);
 else   if (Object_.Eq(c,Char_.Cls_ref_type))   return LuaValue.valueOf((Character)o);
 else   if (Object_.Eq(c,Short_.Cls_ref_type))   return LuaValue.valueOf((Short)o);
 else   if (Object_.Eq(c,Decimal_adp.class))   return LuaValue.valueOf(((Decimal_adp)o).To_double());
 else   return LuaValue.NIL;
}
Program: 116865
Project: 116865
Buggy source:
public boolean GetEntity(Scrib_proc_args args,Scrib_proc_rslt rslt){
  Wdata_doc wdoc=Get_wdoc_or_null(args,core);
  if (wdoc == null)   return rslt.Init_ary_empty();
  Wbase_prop_mgr prop_mgr=core.Wiki().Appe().Wiki_mgr().Wdata_mgr().Prop_mgr();
  return rslt.Init_obj(Scrib_lib_wikibase_srl.Srl(prop_mgr,wdoc,true,false));
}

Fixed version (ground truth):
public boolean GetEntity(Scrib_proc_args args,Scrib_proc_rslt rslt){
  Wdata_doc wdoc=Get_wdoc_or_null(args,core);
  if (wdoc == null)   return rslt.Init_obj(Keyval_.Ary_empty);
  Wbase_prop_mgr prop_mgr=core.Wiki().Appe().Wiki_mgr().Wdata_mgr().Prop_mgr();
  return rslt.Init_obj(Scrib_lib_wikibase_srl.Srl(prop_mgr,wdoc,true,false));
}
Program: 116866
Project: 116866
Buggy source:
public static String Ary_to_str(Keyval... ary){
  String_bldr sb=String_bldr_.new_();
  int len=ary.length;
  for (int i=0; i < len; i++) {
    Keyval itm=ary[i];
    sb.Add(itm.Key()).Add("String_Node_Str");
    Object itm_val=itm.Val();
    if (Type_adp_.Eq_typeSafe(itm_val,Keyval[].class))     sb.Add(Ary_to_str((Keyval[])itm_val));
 else     sb.Add(Object_.Xto_str_strict_or_null_mark(itm_val));
    sb.Add_char_nl();
  }
  return sb.To_str();
}

Fixed version (ground truth):
public static String Ary_to_str(Keyval... ary){
  String_bldr sb=String_bldr_.new_();
  int len=ary.length;
  for (int i=0; i < len; i++) {
    Keyval itm=ary[i];
    if (itm == null) {
      sb.Add("String_Node_Str");
      continue;
    }
    sb.Add(itm.Key()).Add("String_Node_Str");
    Object itm_val=itm.Val();
    if (Type_adp_.Eq_typeSafe(itm_val,Keyval[].class))     sb.Add(Ary_to_str((Keyval[])itm_val));
 else     sb.Add(Object_.Xto_str_strict_or_null_mark(itm_val));
    sb.Add_char_nl();
  }
  return sb.To_str();
}
Program: 116867
Project: 116867
Buggy source:
public Keyval[] Pull_kv_ary_safe(int idx){
  Keyval[] rv=(Keyval[])Get_or_fail(idx);
  int rv_len=rv.length;
  List_adp list=null;
  int prv_key=-1;
  for (int i=0; i < rv_len; ++i) {
    Keyval kv=rv[i];
    if (kv.Key_tid() == Type_adp_.Tid__int || kv.Key_tid() == Type_adp_.Tid__obj) {
      Object key_obj=kv.Key_as_obj();
      if (key_obj.getClass() == Int_.Cls_ref_type) {
        int expd_key=i + List_adp_.Base1;
        int actl_key=Int_.cast(kv.Key_as_obj());
        if (actl_key != expd_key) {
          if (list == null) {
            list=List_adp_.New();
            for (int j=0; j < i; ++j)             list.Add(rv[j]);
            prv_key=i + 1;
          }
          for (int j=prv_key; j < actl_key; ++j)           list.Add(Keyval_.int_(j,null));
          prv_key=actl_key + 1;
        }
      }
    }
    if (list != null)     list.Add(kv);
  }
  return (list == null) ? rv : (Keyval[])list.To_ary(Keyval.class);
}

Fixed version (ground truth):
public Keyval[] Pull_kv_ary_safe(int idx){
  Keyval[] rv=(Keyval[])Get_or_fail(idx);
  int rv_len=rv.length;
  List_adp list=null;
  int prv_key=-1;
  for (int i=0; i < rv_len; ++i) {
    Keyval kv=rv[i];
    if (kv == null)     continue;
    if (kv.Key_tid() == Type_adp_.Tid__int || kv.Key_tid() == Type_adp_.Tid__obj) {
      Object key_obj=kv.Key_as_obj();
      if (key_obj.getClass() == Int_.Cls_ref_type) {
        int expd_key=i + List_adp_.Base1;
        int actl_key=Int_.cast(kv.Key_as_obj());
        if (actl_key != expd_key) {
          if (list == null) {
            list=List_adp_.New();
            for (int j=0; j < i; ++j)             list.Add(rv[j]);
            prv_key=i + 1;
          }
          for (int j=prv_key; j < actl_key; ++j)           list.Add(Keyval_.int_(j,null));
          prv_key=actl_key + 1;
        }
      }
    }
    if (list != null)     list.Add(kv);
  }
  return (list == null) ? rv : (Keyval[])list.To_ary(Keyval.class);
}
Program: 116868
Project: 116868
Buggy source:
public boolean ExpandTemplate(Scrib_proc_args args,Scrib_proc_rslt rslt){
  String ttl_str=args.Pull_str(1);
  byte[] ttl_bry=Bry_.new_u8(ttl_str);
  Xoa_ttl ttl=Xoa_ttl.Parse(cur_wiki,ttl_bry);
  if (ttl == null)   return rslt.Init_ary_empty();
  if (!ttl.ForceLiteralLink() && ttl.Ns().Id_is_main())   ttl=Xoa_ttl.Parse(cur_wiki,Bry_.Add(cur_wiki.Ns_mgr().Ns_template().Name_db_w_colon(),ttl_bry));
  Keyval[] args_ary=args.Pull_kv_ary_safe(2);
  byte[] sub_src=null;
  if (ttl.Ns().Id_is_tmpl()) {
    Xot_defn_tmpl tmpl=(Xot_defn_tmpl)core.Wiki().Cache_mgr().Defn_cache().Get_by_key(ttl.Page_db());
    if (tmpl != null)     sub_src=tmpl.Data_raw();
  }
  if (sub_src == null)   sub_src=core.Wiki().Cache_mgr().Page_cache().Get_or_load_as_src(ttl);
  if (sub_src != null) {
    Xot_invk_mock sub_frame=Xot_invk_mock.new_(core.Frame_current().Defn_tid(),0,ttl.Full_txt_w_ttl_case(),args_ary);
    Xot_defn_tmpl transclude_tmpl=ctx.Wiki().Parser_mgr().Main().Parse_text_to_defn_obj(ctx,ctx.Tkn_mkr(),ttl.Ns(),ttl.Page_db(),sub_src);
    Bry_bfr sub_bfr=cur_wiki.Utl__bfr_mkr().Get_k004();
    transclude_tmpl.Tmpl_evaluate(ctx,sub_frame,sub_bfr);
    return rslt.Init_obj(sub_bfr.To_str_and_rls());
  }
 else {
    return rslt.Init_fail("String_Node_Str" + ttl_str + "String_Node_Str");
  }
}

Fixed version (ground truth):
public boolean ExpandTemplate(Scrib_proc_args args,Scrib_proc_rslt rslt){
  String ttl_str=args.Pull_str(1);
  byte[] ttl_bry=Bry_.new_u8(ttl_str);
  Xoa_ttl ttl=Xoa_ttl.Parse(cur_wiki,ttl_bry);
  if (ttl == null) {
    return rslt.Init_fail("String_Node_Str" + ttl_str + "String_Node_Str");
  }
  if (!ttl.ForceLiteralLink() && ttl.Ns().Id_is_main())   ttl=Xoa_ttl.Parse(cur_wiki,Bry_.Add(cur_wiki.Ns_mgr().Ns_template().Name_db_w_colon(),ttl_bry));
  Keyval[] args_ary=args.Pull_kv_ary_safe(2);
  byte[] sub_src=null;
  if (ttl.Ns().Id_is_tmpl()) {
    Xot_defn_tmpl tmpl=(Xot_defn_tmpl)core.Wiki().Cache_mgr().Defn_cache().Get_by_key(ttl.Page_db());
    if (tmpl != null)     sub_src=tmpl.Data_raw();
  }
  if (sub_src == null)   sub_src=core.Wiki().Cache_mgr().Page_cache().Get_or_load_as_src(ttl);
  if (sub_src != null) {
    Xot_invk_mock sub_frame=Xot_invk_mock.new_(core.Frame_current().Defn_tid(),0,ttl.Full_txt_w_ttl_case(),args_ary);
    Xot_defn_tmpl transclude_tmpl=ctx.Wiki().Parser_mgr().Main().Parse_text_to_defn_obj(ctx,ctx.Tkn_mkr(),ttl.Ns(),ttl.Page_db(),sub_src);
    Bry_bfr sub_bfr=cur_wiki.Utl__bfr_mkr().Get_k004();
    transclude_tmpl.Tmpl_evaluate(ctx,sub_frame,sub_bfr);
    return rslt.Init_obj(sub_bfr.To_str_and_rls());
  }
 else {
    return rslt.Init_fail("String_Node_Str" + ttl_str + "String_Node_Str");
  }
}
Program: 116869
Project: 116869
Buggy source:
@Test public void ExpandTemplate__missing_template(){
  fxt.Init_page("String_Node_Str");
  fxt.Test_scrib_proc_err(lib,Scrib_lib_mw.Invk_expandTemplate,Object_.Ary("String_Node_Str","String_Node_Str",Scrib_kv_utl_.flat_many_(1,"String_Node_Str")),"String_Node_Str");
}

Fixed version (ground truth):
@Test public void ExpandTemplate__missing_template(){
  fxt.Init_page("String_Node_Str");
  fxt.Test_scrib_proc_err(lib,Scrib_lib_mw.Invk_expandTemplate,Object_.Ary("String_Node_Str","String_Node_Str",Scrib_kv_utl_.flat_many_(2,"String_Node_Str")),"String_Node_Str");
}
Program: 116871
Project: 116871
Buggy source:
@Test public void Encode_decode(){
  fxt.Test_encode_decode(150370,240,164,173,162);
}

Fixed version (ground truth):
@Test public void Encode_decode(){
  fxt.Test_encode_decode(150370,240,164,173,162);
  fxt.Test_encode_decode(143489,240,163,130,129);
}
Program: 116873
Project: 116873
Buggy source:
public void Select_catlinks_by_page(Xow_wiki wiki,Db_conn cat_link_conn,Xoctg_pagebox_hash hash,int page_id){
  Db_attach_mgr attach_mgr=new Db_attach_mgr(cat_link_conn,new Db_attach_itm("String_Node_Str",wiki.Data__core_mgr().Db__core().Conn()));
  String sql=String_.Concat_lines_nl_skip_last("String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str" + Int_.To_str(page_id));
  sql=attach_mgr.Resolve_sql(sql);
  attach_mgr.Attach();
  Db_rdr rdr=cat_link_conn.Stmt_sql(sql).Exec_select__rls_auto();
  try {
    while (rdr.Move_next()) {
      Xoa_ttl ttl=wiki.Ttl_parse(rdr.Read_int("String_Node_Str"),rdr.Read_bry_by_str("String_Node_Str"));
      Xoctg_pagebox_itm itm=(Xoctg_pagebox_itm)hash.Get_by_ttl(ttl.Full_db());
      if (itm == null)       itm=hash.Add_by_ttl(ttl);
      itm.Load_by_db(rdr.Read_int("String_Node_Str"),DateAdp_.unixtime_utc_ms_(rdr.Read_long("String_Node_Str")));
    }
  }
  finally {
    rdr.Rls();
    attach_mgr.Detach();
  }
  hash.Sort_and_fill_ids();
}

Fixed version (ground truth):
public void Select_catlinks_by_page(Xow_wiki wiki,Db_conn cat_link_conn,Xoctg_pagebox_hash hash,int page_id){
  Db_attach_mgr attach_mgr=new Db_attach_mgr(cat_link_conn,new Db_attach_itm("String_Node_Str",wiki.Data__core_mgr().Db__core().Conn()));
  String sql=String_.Concat_lines_nl_skip_last("String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str" + Int_.To_str(page_id));
  sql=attach_mgr.Resolve_sql(sql);
  attach_mgr.Attach();
  Db_rdr rdr=Db_rdr_.Empty;
  try {
    rdr=cat_link_conn.Stmt_sql(sql).Exec_select__rls_auto();
    while (rdr.Move_next()) {
      Xoa_ttl ttl=wiki.Ttl_parse(rdr.Read_int("String_Node_Str"),rdr.Read_bry_by_str("String_Node_Str"));
      Xoctg_pagebox_itm itm=(Xoctg_pagebox_itm)hash.Get_by_ttl(ttl.Full_db());
      if (itm == null)       itm=hash.Add_by_ttl(ttl);
      itm.Load_by_db(rdr.Read_int("String_Node_Str"),DateAdp_.unixtime_utc_ms_(rdr.Read_long("String_Node_Str")));
    }
  }
 catch (  Exception e) {
    Gfo_usr_dlg_.Instance.Warn_many("String_Node_Str","String_Node_Str","String_Node_Str",page_id,Err_.Message_gplx_log(e));
  }
 finally {
    rdr.Rls();
    attach_mgr.Detach();
  }
  hash.Sort_and_fill_ids();
}
Program: 116874
Project: 116874
Buggy source:
public byte[] Convert(byte[] src){
  if (general_trie.Count() == 0)   return src;
  Bry_bfr dirty_bfr=null;
  int cur=0;
  int len=src.length;
  while (cur < len) {
    int uniq_bgn=Bry_find_.Find_fwd(src,Bry__uniq__add__bgn,cur);
    if (uniq_bgn == Bry_find_.Not_found)     break;
    int uniq_end=Bry_find_.Find_fwd(src,Bry__uniq__add__end,uniq_bgn);
    if (uniq_end == Bry_find_.Not_found) {
      Gfo_usr_dlg_.Instance.Warn_many("String_Node_Str","String_Node_Str","String_Node_Str",src);
      return src;
    }
    uniq_end+=Bry__uniq__add__end.length;
    if (dirty_bfr == null)     dirty_bfr=key_bfr;
    dirty_bfr.Add_mid(src,0,uniq_bgn);
    dirty_bfr.Add((byte[])general_trie.Match_exact(src,uniq_bgn,uniq_end));
    cur=uniq_end;
  }
  if (dirty_bfr != null) {
    dirty_bfr.Add_mid(src,cur,len);
  }
  return dirty_bfr == null ? src : dirty_bfr.To_bry_and_clear();
}

Fixed version (ground truth):
public byte[] Convert(byte[] src){
  if (general_trie.Count() == 0)   return src;
  Bry_bfr dirty_bfr=null;
  int cur=0;
  int len=src.length;
  while (cur < len) {
    int uniq_bgn=Bry_find_.Find_fwd(src,Bry__uniq__add__bgn,cur);
    if (uniq_bgn == Bry_find_.Not_found)     break;
    int uniq_end=Bry_find_.Find_fwd(src,Bry__uniq__add__end,uniq_bgn);
    if (uniq_end == Bry_find_.Not_found) {
      Gfo_usr_dlg_.Instance.Warn_many("String_Node_Str","String_Node_Str","String_Node_Str",src);
      return src;
    }
    uniq_end+=Bry__uniq__add__end.length;
    if (dirty_bfr == null)     dirty_bfr=key_bfr;
    dirty_bfr.Add_mid(src,cur,uniq_bgn);
    dirty_bfr.Add((byte[])general_trie.Match_exact(src,uniq_bgn,uniq_end));
    cur=uniq_end;
  }
  if (dirty_bfr != null) {
    dirty_bfr.Add_mid(src,cur,len);
  }
  return dirty_bfr == null ? src : dirty_bfr.To_bry_and_clear();
}
Program: 116875
Project: 116875
Buggy source:
public Xop_mediawiki_wkr Make(String domain_str,Xop_mediawiki_loader loader){
  Xowe_wiki wiki=(Xowe_wiki)app.Wiki_mgr().Make(Bry_.new_u8(domain_str),app.Fsys_mgr().Wiki_dir());
  if (mode_is_prod)   wiki.Init_by_wiki();
  return new Xop_mediawiki_wkr(wiki,loader);
}

Fixed version (ground truth):
public Xop_mediawiki_wkr Make(String domain_str,Xop_mediawiki_loader loader){
  Xowe_wiki wiki=(Xowe_wiki)app.Wiki_mgr().Make(Bry_.new_u8(domain_str),app.Fsys_mgr().Wiki_dir());
  if (mode_is_prod) {
    wiki.Init_by_wiki();
    wiki.File_mgr().Fsdb_mode().Tid__v2__mp__y_();
  }
  return new Xop_mediawiki_wkr(wiki,loader);
}
Program: 116876
Project: 116876
Buggy source:
public Xop_mediawiki_mgr(String root_str,boolean mode_is_prod){
  Gfo_usr_dlg usr_dlg=Xoa_app_.New__usr_dlg__console();
  Gfo_usr_dlg_.Instance=usr_dlg;
  Io_url root_dir=Io_url_.new_dir_(root_str);
  this.mode_is_prod=mode_is_prod;
  if (mode_is_prod)   gplx.dbs.Db_conn_bldr.Instance.Reg_default_sqlite();
  this.app=new Xoae_app(usr_dlg,gplx.xowa.apps.Xoa_app_mode.Itm_cmd,root_dir,root_dir.GenSubDir("String_Node_Str"),root_dir.GenSubDir("String_Node_Str"),root_dir.GenSubDir("String_Node_Str"),root_dir.GenSubDir_nest("String_Node_Str","String_Node_Str","String_Node_Str"),gplx.xowa.apps.boots.Xoa_cmd_arg_mgr.Bin_dir_name());
  if (mode_is_prod)   app.Init_by_app();
}

Fixed version (ground truth):
public Xop_mediawiki_mgr(String root_str,boolean mode_is_prod){
  Gfo_usr_dlg usr_dlg=Xoa_app_.New__usr_dlg__console();
  Gfo_usr_dlg_.Instance=usr_dlg;
  Io_url root_dir=Io_url_.new_dir_(root_str);
  this.mode_is_prod=mode_is_prod;
  if (mode_is_prod) {
    gplx.dbs.Db_conn_bldr.Instance.Reg_default_sqlite();
    gplx.core.envs.Env_.Init_swt(String_.Ary_empty,Type_adp_.ClassOf_obj(this));
  }
  this.app=new Xoae_app(usr_dlg,gplx.xowa.apps.Xoa_app_mode.Itm_cmd,root_dir,root_dir.GenSubDir("String_Node_Str"),root_dir.GenSubDir("String_Node_Str"),root_dir.GenSubDir("String_Node_Str"),root_dir.GenSubDir_nest("String_Node_Str","String_Node_Str","String_Node_Str"),gplx.xowa.apps.boots.Xoa_cmd_arg_mgr.Bin_dir_name());
  if (mode_is_prod)   app.Init_by_app();
}
Program: 116877
Project: 116877
Buggy source:
private Xot_defn Match_bgn(byte[] src,int bgn,int end){
  Object cs_obj=cs_trie.Match_bgn(src,bgn,end);
  Xot_defn rv=null;
  if (cs_obj != null) {
    rv=(Xot_defn)cs_obj;
    if (rv.Name().length == end - bgn)     return rv;
  }
  LowerAry(src,bgn,end);
  byte[] ary=lang.Case_mgr().Case_build_lower(lower_ary,0,end - bgn);
  Xot_defn rv_alt=(Xot_defn)ci_trie.Match_bgn(ary,0,end - bgn);
  return (rv != null && rv_alt == null) ? rv : rv_alt;
}

Fixed version (ground truth):
private Xot_defn Match_bgn(byte[] src,int bgn,int end){
  Object cs_obj=cs_trie.Match_bgn(src,bgn,end);
  Xot_defn rv=null;
  if (cs_obj != null) {
    rv=(Xot_defn)cs_obj;
    if (rv.Name().length == end - bgn)     return rv;
  }
  byte[] ary=lang.Case_mgr().Case_build_lower(src,bgn,end);
  Xot_defn rv_alt=(Xot_defn)ci_trie.Match_bgn(ary,0,ary.length);
  return (rv != null && rv_alt == null) ? rv : rv_alt;
}
Program: 116879
Project: 116879
Buggy source:
public Object Get_by_or_null(int key){
  return hash.Get_by(tmp_key.Val_(key));
}

Fixed version (ground truth):
public Object Get_by_or_null(int key){
synchronized (tmp_key) {
    return hash.Get_by(tmp_key.Val_(key));
  }
}
Program: 116880
Project: 116880
Buggy source:
public Object Get_by_or_fail(int key){
  return hash.Get_by_or_fail(tmp_key.Val_(key));
}

Fixed version (ground truth):
public Object Get_by_or_fail(int key){
synchronized (tmp_key) {
    return hash.Get_by_or_fail(tmp_key.Val_(key));
  }
}
Program: 116881
Project: 116881
Buggy source:
public GfoMsg Bld(byte[] src){
  Gfs_nde nde=parser.Parse(src);
  return Bld_msg(src,nde);
}

Fixed version (ground truth):
public GfoMsg Bld(byte[] src){
synchronized (thread_lock) {
    Gfs_nde nde=parser.Parse(src);
    return Bld_msg(src,nde);
  }
}
Program: 116882
Project: 116882
Buggy source:
private static void Load_sortkey(Xow_wiki wiki,Xoctg_catpage_grp grp,Xoctg_catpage_itm zth_itm){
  Xowd_page_itm tmp_pg=new Xowd_page_itm();
  wiki.Data__core_mgr().Tbl__page().Select_by_id(tmp_pg,zth_itm.Page_id());
  Xoa_ttl zth_ttl=wiki.Ttl_parse(tmp_pg.Ns_id(),tmp_pg.Ttl_page_db());
  zth_itm.Page_ttl_(zth_ttl);
  byte[] prv_sortkey=grp.Itms__len() == 0 ? Bry_.Empty : grp.Itms__get_at(grp.Itms__len() - 1).Sortkey_handle();
  zth_itm.Sortkey_handle_make(Bry_bfr_.New(),prv_sortkey);
}

Fixed version (ground truth):
private static void Load_sortkey(Xow_wiki wiki,Xoctg_catpage_grp grp,Xoctg_catpage_itm zth_itm){
  Xowd_page_itm tmp_pg=new Xowd_page_itm();
  wiki.Data__core_mgr().Tbl__page().Select_by_id(tmp_pg,zth_itm.Page_id());
  if (tmp_pg.Exists()) {
    Xoa_ttl zth_ttl=wiki.Ttl_parse(tmp_pg.Ns_id(),tmp_pg.Ttl_page_db());
    zth_itm.Page_ttl_(zth_ttl);
  }
  byte[] prv_sortkey=grp.Itms__len() == 0 ? Bry_.Empty : grp.Itms__get_at(grp.Itms__len() - 1).Sortkey_handle();
  zth_itm.Sortkey_handle_make(Bry_bfr_.New(),prv_sortkey);
}
Program: 116883
Project: 116883
Buggy source:
public static int Find_fwd_or(byte[] src,byte lkp,int cur,int end,int or){
  int rv=Find_fwd(src,lkp,cur,end);
  return rv == Bry_find_.Not_found ? or : rv;
}

Fixed version (ground truth):
public static int Find_fwd_or(byte[] src,byte[] lkp,int cur,int end,int or){
  int rv=Find_fwd(src,lkp,cur,end);
  return rv == Bry_find_.Not_found ? or : rv;
}
Program: 116884
Project: 116884
Buggy source:
public Ordered_hash Parse(byte[] raw){
  Ordered_hash rv=Ordered_hash_.New_bry();
  int bgn=Bry_find_.Find_fwd(raw,Tkn__create_table);
  if (bgn == Bry_find_.Not_found)   throw Err_.new_wo_type("String_Node_Str");
  bgn=Bry_find_.Find_fwd(raw,Byte_ascii.Nl,bgn);
  if (bgn == Bry_find_.Not_found)   throw Err_.new_wo_type("String_Node_Str");
  bgn+=1;
  int end=Bry_find_.Find_fwd(raw,Tkn__primary_key);
  if (end == Bry_find_.Not_found) {
    end=Bry_find_.Find_fwd(raw,Tkn__unique_index);
    if (end == Bry_find_.Not_found)     throw Err_.new_wo_type("String_Node_Str");
  }
  end=Bry_find_.Find_bwd(raw,Byte_ascii.Nl,end);
  if (bgn == Bry_find_.Not_found)   throw Err_.new_wo_type("String_Node_Str");
  Parse_flds(rv,Bry_.Mid(raw,bgn,end));
  return rv;
}

Fixed version (ground truth):
public Ordered_hash Parse(byte[] raw){
  Ordered_hash rv=Ordered_hash_.New_bry();
  Parse_flds(rv,Extract_flds(raw));
  return rv;
}
Program: 116885
Project: 116885
Buggy source:
@Test public void Primary_key(){
  fxt.Exec__parse(String_.Concat_lines_nl("String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str"));
  fxt.Test__count(3);
  fxt.Test__get("String_Node_Str",2);
  fxt.Test__get("String_Node_Str",1);
  fxt.Test__get("String_Node_Str",0);
  fxt.Test__get("String_Node_Str",-1);
}

Fixed version (ground truth):
@Test public void Primary_key(){
  fxt.Test__extract(String_.Concat_lines_nl("String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str"),String_.Concat_lines_nl("String_Node_Str"));
}
Program: 116886
Project: 116886
Buggy source:
public Xowd_html_tbl Tbls__get_or_new(int ns_id,long html_len){
  long len_new=len_cur + html_len;
  boolean not_inited=html_tbl == null, out_of_space=len_new > len_max;
  boolean is_all_or_few=db_mgr.Props().Layout_html().Tid_is_all_or_few();
  boolean ns_changed=ns_id != prv_ns_id;
  if (not_inited || out_of_space || ns_changed) {
    Commit();
    if (is_all_or_few && not_inited) {
      this.html_db=wiki.Data__core_mgr().Dbs__get_by_tid_or_null(Xow_db_file_.Tid__html_data);
      if (html_db == null)       Make_html_db(is_all_or_few,ns_id);
    }
 else     Make_html_db(is_all_or_few,ns_id);
    this.html_tbl=new Xowd_html_tbl(html_db.Conn());
    html_tbl.Create_tbl();
    html_db.Conn().Txn_bgn("String_Node_Str");
    len_cur=html_len;
  }
 else   len_cur=len_new;
  return html_tbl;
}

Fixed version (ground truth):
public Xowd_html_tbl Tbls__get_or_new(int ns_id,long html_len){
  long len_new=len_cur + html_len;
  boolean not_inited=html_tbl == null, out_of_space=len_new > len_max;
  boolean is_all_or_few=db_mgr.Props().Layout_html().Tid_is_all_or_few();
  boolean ns_changed=ns_id != prv_ns_id;
  if (not_inited || out_of_space || (ns_changed && !is_all_or_few)) {
    Commit();
    if (is_all_or_few && not_inited) {
      this.html_db=wiki.Data__core_mgr().Dbs__get_by_tid_or_null(Xow_db_file_.Tid__html_data);
      if (html_db == null)       Make_html_db(is_all_or_few,ns_id);
    }
 else     Make_html_db(is_all_or_few,ns_id);
    this.html_tbl=new Xowd_html_tbl(html_db.Conn());
    html_tbl.Create_tbl();
    html_db.Conn().Txn_bgn("String_Node_Str");
    len_cur=html_len;
  }
 else   len_cur=len_new;
  return html_tbl;
}
Program: 116887
Project: 116887
Buggy source:
protected Window.Callback getWindowCallback(){
  if (_windowCallback == null) {
    _windowCallback=window.getCallback();
  }
  return _windowCallback;
}

Fixed version (ground truth):
protected Window.Callback getWindowCallback(){
  return window.getCallback();
}
Program: 116891
Project: 116891
Buggy source:
/** 
 * Create a client for a clientId that already exists in Odo
 * @param profileName name of existing profile to create client for
 * @param clientId clientId of existing Odo client
 * @throws Exception
 */
public Client(String profileName,String clientId) throws Exception {
  new Client(profileName,clientId,null);
}

Fixed version (ground truth):
/** 
 * Create a client for a clientId that already exists in Odo
 * @param profileName name of existing profile to create client for
 * @param clientId clientId of existing Odo client
 * @throws Exception
 */
public Client(String profileName,String clientId) throws Exception {
  this(profileName,clientId,null);
}
Program: 116892
Project: 116892
Buggy source:
/** 
 * Create a client for a clientId that already exists in Odo
 * @param profileName name of existing profile to create client for
 * @param clientId clientId of existing Odo client
 * @throws Exception
 */
public Client(String profileName,String clientId) throws Exception {
  new Client(profileName,clientId,null);
}

Fixed version (ground truth):
/** 
 * Create a client for a clientId that already exists in Odo
 * @param profileName name of existing profile to create client for
 * @param clientId clientId of existing Odo client
 * @throws Exception
 */
public Client(String profileName,String clientId) throws Exception {
  this(profileName,clientId,null);
}
Program: 116893
Project: 116893
Buggy source:
@Test public void getHistory() throws Exception {
  History[] histories=HistoryService.getInstance().getHistory(newProfile.getId(),"String_Node_Str",0,100,true,null);
  History latest=histories[histories.length - 1];
  assertTrue(latest.getOriginalRequestHeaders().equals("String_Node_Str"));
  assertTrue(latest.getOriginalRequestParams().equals("String_Node_Str"));
  assertTrue(latest.getOriginalRequestPostData().equals("String_Node_Str"));
  assertTrue(latest.getOriginalRequestURL().equals("String_Node_Str"));
  assertTrue(latest.getOriginalResponseCode().equals("String_Node_Str"));
  assertTrue(latest.getOriginalResponseContentType().equals("String_Node_Str"));
  assertTrue(latest.getOriginalResponseData().equals("String_Node_Str"));
  assertTrue(latest.getOriginalResponseHeaders().equals("String_Node_Str"));
  assertTrue(latest.getRequestHeaders().equals("String_Node_Str"));
  assertTrue(latest.getRequestParams().equals("String_Node_Str"));
  assertTrue(latest.getRequestPostData().equals("String_Node_Str"));
  assertTrue(latest.getRequestType().equals("String_Node_Str"));
  assertTrue(latest.getRequestURL().equals("String_Node_Str"));
  assertTrue(latest.getResponseCode().equals("String_Node_Str"));
  assertTrue(latest.getResponseContentType().equals("String_Node_Str"));
  assertTrue(latest.getResponseData().equals("String_Node_Str"));
  assertTrue(latest.getResponseHeaders().equals("String_Node_Str"));
}

Fixed version (ground truth):
@Test public void getHistory() throws Exception {
  History[] histories=HistoryService.getInstance().getHistory(newProfile.getId(),"String_Node_Str",0,100,true,null,false);
  History latest=histories[histories.length - 1];
  assertTrue(latest.getOriginalRequestHeaders().equals("String_Node_Str"));
  assertTrue(latest.getOriginalRequestParams().equals("String_Node_Str"));
  assertTrue(latest.getOriginalRequestPostData().equals("String_Node_Str"));
  assertTrue(latest.getOriginalRequestURL().equals("String_Node_Str"));
  assertTrue(latest.getOriginalResponseCode().equals("String_Node_Str"));
  assertTrue(latest.getOriginalResponseContentType().equals("String_Node_Str"));
  assertTrue(latest.getOriginalResponseData().equals("String_Node_Str"));
  assertTrue(latest.getOriginalResponseHeaders().equals("String_Node_Str"));
  assertTrue(latest.getRequestHeaders().equals("String_Node_Str"));
  assertTrue(latest.getRequestParams().equals("String_Node_Str"));
  assertTrue(latest.getRequestPostData().equals("String_Node_Str"));
  assertTrue(latest.getRequestType().equals("String_Node_Str"));
  assertTrue(latest.getRequestURL().equals("String_Node_Str"));
  assertTrue(latest.getResponseCode().equals("String_Node_Str"));
  assertTrue(latest.getResponseContentType().equals("String_Node_Str"));
  assertTrue(latest.getResponseData().equals("String_Node_Str"));
  assertTrue(latest.getResponseHeaders().equals("String_Node_Str"));
}
Program: 116895
Project: 116895
Buggy source:
/** 
 * Sets up the given   {@link org.apache.commons.httpclient.methods.PostMethod} to send the same multipart POST dataas was sent in the given  {@link HttpServletRequest}
 * @param postMethodProxyRequest The {@link org.apache.commons.httpclient.methods.PostMethod} that we are configuring to send amultipart POST request
 * @param httpServletRequest     The {@link HttpServletRequest} that contains the multipartPOST data to be sent via the  {@link org.apache.commons.httpclient.methods.PostMethod}
 */
@SuppressWarnings("String_Node_Str") public static void handleMultipartPost(EntityEnclosingMethod postMethodProxyRequest,HttpServletRequest httpServletRequest,DiskFileItemFactory diskFileItemFactory) throws ServletException {
  ServletFileUpload servletFileUpload=new ServletFileUpload(diskFileItemFactory);
  try {
    List<FileItem> listFileItems=(List<FileItem>)servletFileUpload.parseRequest(httpServletRequest);
    List<Part> listParts=new ArrayList<Part>();
    for (    FileItem fileItemCurrent : listFileItems) {
      if (fileItemCurrent.isFormField()) {
        StringPart stringPart=new StringPart(fileItemCurrent.getFieldName(),fileItemCurrent.getString());
        listParts.add(stringPart);
      }
 else {
        FilePart filePart=new FilePart(fileItemCurrent.getFieldName(),new ByteArrayPartSource(fileItemCurrent.getName(),fileItemCurrent.get()));
        listParts.add(filePart);
      }
    }
    MultipartRequestEntity multipartRequestEntity=new MultipartRequestEntity(listParts.toArray(new Part[listParts.size()]),postMethodProxyRequest.getParams());
    postMethodProxyRequest.setRequestEntity(multipartRequestEntity);
    postMethodProxyRequest.setRequestHeader(STRING_CONTENT_TYPE_HEADER_NAME,multipartRequestEntity.getContentType());
  }
 catch (  FileUploadException fileUploadException) {
    throw new ServletException(fileUploadException);
  }
}

Fixed version (ground truth):
/** 
 * Sets up the given   {@link org.apache.commons.httpclient.methods.PostMethod} to send the same multipart POST dataas was sent in the given  {@link HttpServletRequest}
 * @param postMethodProxyRequest The {@link org.apache.commons.httpclient.methods.PostMethod} that we are configuring to send amultipart POST request
 * @param httpServletRequest     The {@link HttpServletRequest} that contains the multipartPOST data to be sent via the  {@link org.apache.commons.httpclient.methods.PostMethod}
 */
@SuppressWarnings("String_Node_Str") public static void handleMultipartPost(EntityEnclosingMethod postMethodProxyRequest,HttpServletRequest httpServletRequest,DiskFileItemFactory diskFileItemFactory) throws ServletException {
  try {
    InputStreamRequestEntity ire=new InputStreamRequestEntity(httpServletRequest.getInputStream());
    postMethodProxyRequest.setRequestEntity(ire);
    postMethodProxyRequest.setRequestHeader(STRING_CONTENT_TYPE_HEADER_NAME,httpServletRequest.getHeader(STRING_CONTENT_TYPE_HEADER_NAME));
  }
 catch (  Exception e) {
    throw new ServletException(e);
  }
}
Program: 116898
Project: 116898
Buggy source:
/** 
 * Obtain matching paths for a request
 * @param overrideType
 * @param client
 * @param profile
 * @param uri
 * @param requestType
 * @param pathTest - If true this will also match disabled paths
 * @return
 * @throws Exception
 */
public List<EndpointOverride> getSelectedPaths(int overrideType,Client client,Profile profile,String uri,Integer requestType,boolean pathTest) throws Exception {
  List<EndpointOverride> selectPaths=new ArrayList<EndpointOverride>();
  List<EndpointOverride> paths=new ArrayList<EndpointOverride>();
  if (client.getIsActive()) {
    paths=getPaths(profile.getId(),client.getUUID(),null);
  }
  boolean foundRealPath=false;
  logger.info("String_Node_Str",uri);
  for (  EndpointOverride path : paths) {
    if (requestType != -1 && path.getRequestType() != requestType && path.getRequestType() != Constants.REQUEST_TYPE_ALL)     continue;
    Pattern pattern=Pattern.compile(path.getPath());
    Matcher matcher=pattern.matcher(uri);
    if (matcher.find()) {
      if (pathTest || (path.getEnabledEndpoints().size() > 0 && ((overrideType == Constants.OVERRIDE_TYPE_RESPONSE && path.getResponseEnabled()) || (overrideType == Constants.OVERRIDE_TYPE_REQUEST && path.getRequestEnabled())))) {
        if (!foundRealPath || path.getGlobal())         selectPaths.add(path);
      }
      if (!path.getGlobal()) {
        foundRealPath=true;
      }
    }
  }
  return selectPaths;
}

Fixed version (ground truth):
/** 
 * Obtain matching paths for a request
 * @param overrideType
 * @param client
 * @param profile
 * @param uri
 * @param requestType
 * @param pathTest - If true this will also match disabled paths
 * @return
 * @throws Exception
 */
public List<EndpointOverride> getSelectedPaths(int overrideType,Client client,Profile profile,String uri,Integer requestType,boolean pathTest) throws Exception {
  List<EndpointOverride> selectPaths=new ArrayList<EndpointOverride>();
  List<EndpointOverride> paths=new ArrayList<EndpointOverride>();
  if (client.getIsActive()) {
    paths=getPaths(profile.getId(),client.getUUID(),null);
  }
  boolean foundRealPath=false;
  logger.info("String_Node_Str",uri);
  for (  EndpointOverride path : paths) {
    if (requestType != -1 && path.getRequestType() != requestType && path.getRequestType() != Constants.REQUEST_TYPE_ALL)     continue;
    try {
      Pattern pattern=Pattern.compile(path.getPath());
      Matcher matcher=pattern.matcher(uri);
      if (matcher.find()) {
        if (pathTest || (path.getEnabledEndpoints().size() > 0 && ((overrideType == Constants.OVERRIDE_TYPE_RESPONSE && path.getResponseEnabled()) || (overrideType == Constants.OVERRIDE_TYPE_REQUEST && path.getRequestEnabled())))) {
          if (!foundRealPath || path.getGlobal())           selectPaths.add(path);
        }
        if (!path.getGlobal()) {
          foundRealPath=true;
        }
      }
    }
 catch (    PatternSyntaxException pse) {
    }
  }
  return selectPaths;
}
Program: 116901
Project: 116901
Buggy source:
/** 
 * Returns a X509 binary certificate for a given domain name if a certificate has been generated for it
 * @param locale
 * @param model
 * @param response
 * @param hostname
 * @throws Exception
 */
@RequestMapping(value="String_Node_Str",method={RequestMethod.GET,RequestMethod.HEAD}) public @ResponseBody void getCert(Locale locale,Model model,HttpServletResponse response,@PathVariable String hostname) throws Exception {
  if (hostname.equals("String_Node_Str")) {
    hostname="String_Node_Str";
  }
  response.reset();
  response.setContentType("String_Node_Str");
  response.setHeader("String_Node_Str","String_Node_Str" + hostname + "String_Node_Str");
  if (hostname.equals("String_Node_Str")) {
    File root=new File("String_Node_Str");
    com.groupon.odo.proxylib.Utils.copyResourceToLocalFile(hostname + "String_Node_Str",root.getAbsolutePath() + File.separator + hostname+ "String_Node_Str");
    Files.copy(new File(root.getAbsolutePath() + File.separator + "String_Node_Str").toPath(),response.getOutputStream());
    response.flushBuffer();
  }
 else {
    KeyStoreManager keyStoreManager=com.groupon.odo.bmp.Utils.getKeyStoreManager(hostname);
    response.getOutputStream().write(keyStoreManager.getCertificateByAlias(hostname).getEncoded());
    response.flushBuffer();
  }
}

Fixed version (ground truth):
/** 
 * Returns a X509 binary certificate for a given domain name if a certificate has been generated for it
 * @param locale
 * @param model
 * @param response
 * @param hostname
 * @throws Exception
 */
@RequestMapping(value="String_Node_Str",method={RequestMethod.GET,RequestMethod.HEAD}) public @ResponseBody void getCert(Locale locale,Model model,HttpServletResponse response,@PathVariable String hostname) throws Exception {
  response.reset();
  response.setContentType("String_Node_Str");
  response.setHeader("String_Node_Str","String_Node_Str" + hostname + "String_Node_Str");
  if (hostname.equals("String_Node_Str")) {
    hostname="String_Node_Str";
    response.setContentType("String_Node_Str");
  }
  KeyStoreManager keyStoreManager=com.groupon.odo.bmp.Utils.getKeyStoreManager(hostname);
  if (hostname.equals("String_Node_Str")) {
    File root=new File("String_Node_Str" + File.separator + hostname);
    Files.copy(new File(root.getAbsolutePath() + File.separator + hostname+ "String_Node_Str").toPath(),response.getOutputStream());
    response.flushBuffer();
  }
 else {
    response.getOutputStream().write(keyStoreManager.getCertificateByAlias(hostname).getEncoded());
    response.flushBuffer();
  }
}
Program: 116902
Project: 116902
Buggy source:
/** 
 * Obtain database connection
 * @return
 * @throws SQLException
 */
public Connection getConnection() throws SQLException {
  try {
    if (_connection != null) {
      if (_connection.isValid(1)) {
        _connection=null;
        try {
          startServer();
        }
 catch (        Exception e) {
        }
      }
    }
    if (_connection == null) {
      String connectString="String_Node_Str" + databaseHost + "String_Node_Str"+ String.valueOf(port)+ "String_Node_Str"+ this.databaseName+ "String_Node_Str";
      _connection=DriverManager.getConnection(connectString,"String_Node_Str","String_Node_Str");
    }
  }
 catch (  Exception e) {
    logger.info("String_Node_Str",e.getClass());
  }
  return _connection;
}

Fixed version (ground truth):
/** 
 * Obtain database connection
 * @return
 * @throws SQLException
 */
public Connection getConnection() throws SQLException {
  try {
    if (_connection != null) {
      if (!_connection.isValid(1)) {
        _connection=null;
        try {
          startServer();
        }
 catch (        Exception e) {
        }
      }
    }
    if (_connection == null) {
      String connectString="String_Node_Str" + databaseHost + "String_Node_Str"+ String.valueOf(port)+ "String_Node_Str"+ this.databaseName+ "String_Node_Str";
      _connection=DriverManager.getConnection(connectString,"String_Node_Str","String_Node_Str");
    }
  }
 catch (  Exception e) {
    logger.info("String_Node_Str",e.getClass());
  }
  return _connection;
}
Program: 116903
Project: 116903
Buggy source:
public String getAttribute(String name){
  return attributes.containsKey(name) ? attributes.get(name) : null;
}

Fixed version (ground truth):
public Object getAttribute(String name){
  return attributes.containsKey(name) ? attributes.get(name) : null;
}
Program: 116904
Project: 116904
Buggy source:
private void populateAttributes(HttpServletRequest request){
  Enumeration attributeNames=request.getAttributeNames();
  this.attributes=new HashMap<String,String>();
  while (attributeNames.hasMoreElements()) {
    String headerName=(String)attributeNames.nextElement();
    String value=request.getHeader(headerName);
    this.headers.put(headerName,value);
  }
}

Fixed version (ground truth):
private void populateAttributes(HttpServletRequest request){
  Enumeration attributeNames=request.getAttributeNames();
  this.attributes=new HashMap<String,Object>();
  while (attributeNames.hasMoreElements()) {
    String attrName=(String)attributeNames.nextElement();
    Object value=request.getAttribute(attrName);
    this.attributes.put(attrName,value);
  }
}
Program: 116905
Project: 116905
Buggy source:
public HttpRequestInfo(HttpServletRequest request){
  this.authType=request.getAuthType();
  this.contextPath=request.getContextPath();
  populateHeaders(request);
  this.method=request.getMethod();
  this.pathInfo=request.getPathInfo();
  this.queryString=request.getQueryString();
  this.requestURI=request.getRequestURI();
  this.servletPath=request.getServletPath();
  this.contentType=request.getContentType();
  this.characterEncoding=request.getCharacterEncoding();
  this.contentLength=request.getContentLength();
  this.localName=request.getLocalName();
  this.localPort=request.getLocalPort();
  this.parameterMap=request.getParameterMap();
  this.protocol=request.getProtocol();
  this.remoteAddr=request.getRemoteAddr();
  this.remoteHost=request.getRemoteHost();
  this.remotePort=request.getRemotePort();
  this.serverName=request.getServerName();
  this.secure=request.isSecure();
  populateAttributes(request);
}

Fixed version (ground truth):
public HttpRequestInfo(HttpServletRequest request,String postContent){
  this(request);
  this.postContent=postContent;
}