nus-yam/ex-repair huggingface dataset:
Program: 43660
Project: 43660
Buggy source:
public Object get(HttpServletRequest req,HttpServletResponse resp,Object refer){
  Object obj=mirror.born();
  for (int i=0; i < injs.length; i++) {
    Injecting inj=injs[i];
    String s=req.getParameter(names[i]);
    if (Strings.isBlank(s))     s=null;
    inj.inject(obj,s);
  }
  return obj;
}

Fixed version (ground truth):
public Object get(HttpServletRequest req,HttpServletResponse resp,Object refer){
  Object obj=mirror.born();
  for (int i=0; i < injs.length; i++) {
    Injecting inj=injs[i];
    String s=req.getParameter(names[i]);
    if (null == s)     continue;
    if (Strings.isBlank(s))     s=null;
    inj.inject(obj,s);
  }
  return obj;
}
Program: 43661
Project: 43661
Buggy source:
public void update(Dao dao,Object obj){
  if (null == obj)   return;
  Sql sql=this.sql.duplicate();
  if (vars.length > 0) {
    sql.vars().set("String_Node_Str",ef.getEntity().getViewName());
    sql.vars().set("String_Node_Str",ef.getColumnName());
    Object refer=TableName.get();
    if (null != refer) {
      if (TableName.isPrimitive(refer))       for (      String var : vars)       if (var.equals("String_Node_Str") || var.equals("String_Node_Str"))       continue;
 else       sql.vars().set(var,refer);
 else {
        Mirror<?> me=Mirror.me(refer.getClass());
        for (        String var : vars) {
          if (var.equals("String_Node_Str") || var.equals("String_Node_Str"))           continue;
 else {
            Object v=me.getValue(refer,var);
            sql.vars().set(var,v);
          }
        }
      }
    }
  }
  if (params.length > 0) {
    Mirror<?> me=Mirror.me(obj.getClass());
    for (    Field f : params) {
      Object v=me.getValue(obj,f);
      sql.params().set(f.getName(),v);
    }
  }
  dao.execute(sql);
  ef.setValue(obj,sql.getResult());
}

Fixed version (ground truth):
public void update(Dao dao,Object obj){
  if (null == obj)   return;
  Sql sql=this.sql.duplicate();
  if (vars.length > 0) {
    sql.vars().set("String_Node_Str",ef.getEntity().getViewName());
    sql.vars().set("String_Node_Str",ef.getColumnName());
    Object refer=TableName.get();
    if (null == refer)     refer=obj;
    if (null != refer) {
      if (TableName.isPrimitive(refer))       for (      String var : vars)       if (var.equals("String_Node_Str") || var.equals("String_Node_Str"))       continue;
 else       sql.vars().set(var,refer);
 else {
        Mirror<?> me=Mirror.me(refer.getClass());
        for (        String var : vars) {
          if (var.equals("String_Node_Str") || var.equals("String_Node_Str"))           continue;
 else {
            Object v=me.getValue(refer,var);
            sql.vars().set(var,v);
          }
        }
      }
    }
  }
  if (params.length > 0) {
    Mirror<?> me=Mirror.me(obj.getClass());
    for (    Field f : params) {
      Object v=me.getValue(obj,f);
      sql.params().set(f.getName(),v);
    }
  }
  dao.execute(sql);
  ef.setValue(obj,sql.getResult());
}
Program: 43662
Project: 43662
Buggy source:
/** 
 * 清除数据表所有记录
 * @param tableName 表名
 */
void clear(String tableName);

Fixed version (ground truth):
/** 
 * 清除数据表所有记录
 * @param tableName 表名
 * @return 影响的行数
 */
int clear(String tableName);
Program: 43663
Project: 43663
Buggy source:
public void clear(String tableName,Condition condition){
  Sql sql;
  if (null == condition) {
    sql=sqlMaker.truncate(tableName);
  }
 else {
    sql=sqlMaker.clear(tableName).setCondition(condition);
  }
  execute(sql);
}

Fixed version (ground truth):
public int clear(String tableName,Condition condition){
  Sql sql;
  if (null == condition) {
    sql=sqlMaker.truncate(tableName);
  }
 else {
    sql=sqlMaker.clear(tableName).setCondition(condition);
  }
  execute(sql);
  return sql.getUpdateCount();
}
Program: 43664
Project: 43664
Buggy source:
public void clear(){
  dao().clear(getEntityClass(),null);
}

Fixed version (ground truth):
public int clear(){
  return dao().clear(getEntityClass(),null);
}
Program: 43665
Project: 43665
Buggy source:
public void delete(long id){
  dao().delete(getEntityClass(),id);
}

Fixed version (ground truth):
public int delete(long id){
  return dao().delete(getEntityClass(),id);
}
Program: 43666
Project: 43666
Buggy source:
public void delete(String name){
  dao().delete(getEntityClass(),name);
}

Fixed version (ground truth):
public int delete(String name){
  return dao().delete(getEntityClass(),name);
}
Program: 43667
Project: 43667
Buggy source:
public void delete(String name){
  dao().delete(getEntityClass(),name);
}

Fixed version (ground truth):
public int delete(String name){
  return dao().delete(getEntityClass(),name);
}
Program: 43668
Project: 43668
Buggy source:
@SuppressWarnings("String_Node_Str") public <T>T fetch(T obj){
  if (null != obj) {
    Entity<?> entity=(Entity)getEntity(obj.getClass());
    EntityField idnf=entity.getIdentifiedField();
    Sql sql;
    if (idnf == null) {
      Object[] args=evalArgsByPks(entity,obj);
      if (null != args) {
        sql=sqlMaker.fetchx(entity,args);
      }
 else {
        throw new DaoException(format("String_Node_Str",entity.getType().getName()));
      }
    }
 else {
      sql=sqlMaker.fetch(entity,idnf);
      sql.params().set(idnf.getFieldName(),idnf.getValue(obj));
    }
    execute(sql);
    return sql.getObject((Class<T>)entity.getType());
  }
  return null;
}

Fixed version (ground truth):
@SuppressWarnings("String_Node_Str") public <T>T fetch(T obj){
  if (null != obj) {
    Entity<?> entity=(Entity)getEntity(obj.getClass());
    EntityField idnf=entity.getIdentifiedField();
    Sql sql;
    if (idnf == null) {
      Object[] args=evalArgsByPks(entity,obj);
      if (null != args) {
        sql=sqlMaker.fetchx(entity,args);
      }
 else {
        throw new DaoException(format("String_Node_Str",entity.getType().getName()));
      }
    }
 else {
      sql=sqlMaker.fetch(entity,idnf);
      sql.params().set(idnf.getName(),idnf.getValue(obj));
    }
    execute(sql);
    return sql.getObject((Class<T>)entity.getType());
  }
  return null;
}
Program: 43669
Project: 43669
Buggy source:
public Sql insert(Entity<?> en,Object obj){
  StringBuilder fields=new StringBuilder();
  StringBuilder values=new StringBuilder();
  FieldMatcher fm=FieldFilter.get(en.getType());
  Map<String,Object> map=new HashMap<String,Object>();
  for (Iterator<EntityField> it=en.fields().iterator(); it.hasNext(); ) {
    EntityField ef=it.next();
    String fn=ef.getFieldName();
    if (ef.isSerial() || ef.isReadonly())     continue;
    Object value=ef.getValue(obj);
    if (null != fm) {
      if (fm.isIgnoreNull() && null == value)       continue;
 else       if (!fm.match(fn))       continue;
    }
 else     if (null == value) {
      if (ef.hasDefaultValue())       value=ef.getDefaultValue(obj);
 else       continue;
    }
    fields.append(',').append(ef.getColumnName());
    values.append("String_Node_Str").append(fn);
    map.put(fn,value);
  }
  fields.deleteCharAt(0);
  values.deleteCharAt(0);
  Sql sql=Sqls.create(format("String_Node_Str",en.getTableName(),fields,values)).setEntity(en);
  sql.params().putAll(map);
  return sql;
}

Fixed version (ground truth):
public Sql insert(Entity<?> en,Object obj){
  StringBuilder fields=new StringBuilder();
  StringBuilder values=new StringBuilder();
  FieldMatcher fm=FieldFilter.get(en.getType());
  Map<String,Object> map=new HashMap<String,Object>();
  for (Iterator<EntityField> it=en.fields().iterator(); it.hasNext(); ) {
    EntityField ef=it.next();
    String fn=ef.getName();
    if (ef.isSerial() || ef.isReadonly())     continue;
    Object value=ef.getValue(obj);
    if (null != fm) {
      if (fm.isIgnoreNull() && null == value)       continue;
 else       if (!fm.match(fn))       continue;
    }
 else     if (null == value) {
      if (ef.hasDefaultValue())       value=ef.getDefaultValue(obj);
 else       continue;
    }
    fields.append(',').append(ef.getColumnName());
    values.append("String_Node_Str").append(fn);
    map.put(fn,value);
  }
  fields.deleteCharAt(0);
  values.deleteCharAt(0);
  Sql sql=Sqls.create(format("String_Node_Str",en.getTableName(),fields,values)).setEntity(en);
  sql.params().putAll(map);
  return sql;
}
Program: 43670
Project: 43670
Buggy source:
public Sql update(Entity<?> en,Object obj){
  StringBuilder sb=new StringBuilder();
  FieldMatcher fm=FieldFilter.get(en.getType());
  Map<String,Object> map=new HashMap<String,Object>();
  for (Iterator<EntityField> it=en.fields().iterator(); it.hasNext(); ) {
    EntityField ef=it.next();
    String fn=ef.getFieldName();
    if (ef == en.getIdentifiedField() || ef.isPk() || ef.isReadonly())     continue;
    Object value=ef.getValue(obj);
    if (null != fm) {
      if (fm.isIgnoreNull() && null == value)       continue;
 else       if (!fm.match(fn))       continue;
    }
    sb.append(',').append(ef.getColumnName()).append('=').append("String_Node_Str").append(fn);
    map.put(fn,value);
  }
  sb.deleteCharAt(0);
  EntityField idf=en.getIdentifiedField();
  if (null != idf) {
    String fmt=format("String_Node_Str",en.getTableName(),sb,idf.getColumnName(),idf.getFieldName());
    Sql sql=Sqls.create(fmt).setEntity(en);
    sql.params().putAll(map).set(idf.getFieldName(),idf.getValue(obj));
    return sql;
  }
  EntityField[] pks=en.getPkFields();
  if (null == pks || pks.length <= 1) {
    throw Lang.makeThrow("String_Node_Str",en.getType());
  }
  Object[] args=new Object[pks.length];
  for (int i=0; i < args.length; i++) {
    args[i]=pks[i].getValue(obj);
  }
  String fmt=format("String_Node_Str",en.getTableName(),sb);
  Sql sql=Sqls.create(fmt).setEntity(en);
  sql.params().putAll(map);
  sql.setCondition(new PkCondition(args));
  return sql;
}

Fixed version (ground truth):
public Sql update(Entity<?> en,Object obj){
  StringBuilder sb=new StringBuilder();
  FieldMatcher fm=FieldFilter.get(en.getType());
  Map<String,Object> map=new HashMap<String,Object>();
  for (Iterator<EntityField> it=en.fields().iterator(); it.hasNext(); ) {
    EntityField ef=it.next();
    String fn=ef.getName();
    if (ef == en.getIdentifiedField() || ef.isPk() || ef.isReadonly())     continue;
    Object value=ef.getValue(obj);
    if (null != fm) {
      if (fm.isIgnoreNull() && null == value)       continue;
 else       if (!fm.match(fn))       continue;
    }
    sb.append(',').append(ef.getColumnName()).append('=').append("String_Node_Str").append(fn);
    map.put(fn,value);
  }
  sb.deleteCharAt(0);
  EntityField idf=en.getIdentifiedField();
  if (null != idf) {
    String fmt=format("String_Node_Str",en.getTableName(),sb,idf.getColumnName(),idf.getName());
    Sql sql=Sqls.create(fmt).setEntity(en);
    sql.params().putAll(map).set(idf.getName(),idf.getValue(obj));
    return sql;
  }
  EntityField[] pks=en.getPkFields();
  if (null == pks || pks.length <= 1) {
    throw Lang.makeThrow("String_Node_Str",en.getType());
  }
  Object[] args=new Object[pks.length];
  for (int i=0; i < args.length; i++) {
    args[i]=pks[i].getValue(obj);
  }
  String fmt=format("String_Node_Str",en.getTableName(),sb);
  Sql sql=Sqls.create(fmt).setEntity(en);
  sql.params().putAll(map);
  sql.setCondition(new PkCondition(args));
  return sql;
}
Program: 43671
Project: 43671
Buggy source:
public Sql delete(Entity<?> entity,EntityField ef){
  return Sqls.create(format("String_Node_Str",entity.getTableName(),ef.getColumnName(),ef.getFieldName())).setEntity(entity);
}

Fixed version (ground truth):
public Sql delete(Entity<?> entity,EntityField ef){
  return Sqls.create(format("String_Node_Str",entity.getTableName(),ef.getColumnName(),ef.getName())).setEntity(entity);
}
Program: 43672
Project: 43672
Buggy source:
public Sql fetch(Entity<?> entity,EntityField ef){
  String fields=evalActivedFields(entity);
  String fmt;
  if (ef == null) {
    fmt=format("String_Node_Str",fields,entity.getViewName());
  }
 else   if (ef.isName() && !ef.isCasesensitive()) {
    fmt=format("String_Node_Str",fields,entity.getViewName(),ef.getColumnName(),ef.getFieldName());
  }
 else {
    fmt=format("String_Node_Str",fields,entity.getViewName(),ef.getColumnName(),ef.getFieldName());
  }
  return Sqls.fetchEntity(fmt).setEntity(entity);
}

Fixed version (ground truth):
public Sql fetch(Entity<?> entity,EntityField ef){
  String fields=evalActivedFields(entity);
  String fmt;
  if (ef == null) {
    fmt=format("String_Node_Str",fields,entity.getViewName());
  }
 else   if (ef.isName() && !ef.isCasesensitive()) {
    fmt=format("String_Node_Str",fields,entity.getViewName(),ef.getColumnName(),ef.getName());
  }
 else {
    fmt=format("String_Node_Str",fields,entity.getViewName(),ef.getColumnName(),ef.getName());
  }
  return Sqls.fetchEntity(fmt).setEntity(entity);
}
Program: 43673
Project: 43673
Buggy source:
public boolean exists(long id){
  EntityField ef=getEntity().getIdField();
  if (null == ef)   return false;
  return dao().count(getEntityClass(),Cnd.where(ef.getFieldName(),"String_Node_Str",id)) > 0;
}

Fixed version (ground truth):
public boolean exists(long id){
  EntityField ef=getEntity().getIdField();
  if (null == ef)   return false;
  return dao().count(getEntityClass(),Cnd.where(ef.getName(),"String_Node_Str",id)) > 0;
}
Program: 43674
Project: 43674
Buggy source:
public boolean exists(String name){
  EntityField ef=getEntity().getNameField();
  if (null == ef)   return false;
  return dao().count(getEntityClass(),Cnd.where(ef.getFieldName(),"String_Node_Str",name)) > 0;
}

Fixed version (ground truth):
public boolean exists(String name){
  EntityField ef=getEntity().getNameField();
  if (null == ef)   return false;
  return dao().count(getEntityClass(),Cnd.where(ef.getName(),"String_Node_Str",name)) > 0;
}
Program: 43675
Project: 43675
Buggy source:
public boolean exists(String name){
  EntityField ef=getEntity().getNameField();
  if (null == ef)   return false;
  return dao().count(getEntityClass(),Cnd.where(ef.getFieldName(),"String_Node_Str",name)) > 0;
}

Fixed version (ground truth):
public boolean exists(String name){
  EntityField ef=getEntity().getNameField();
  if (null == ef)   return false;
  return dao().count(getEntityClass(),Cnd.where(ef.getName(),"String_Node_Str",name)) > 0;
}
Program: 43676
Project: 43676
Buggy source:
private void pojo2Json(Object obj) throws IOException {
  if (null == obj)   return;
  Class<? extends Object> type=obj.getClass();
  ToJson tj=type.getAnnotation(ToJson.class);
  String myMethodName=Strings.sNull(null == tj ? null : tj.value(),"String_Node_Str");
  Method myMethod;
  try {
    myMethod=type.getMethod(myMethodName);
    Object re=myMethod.invoke(obj);
    writer.append(re.toString());
    return;
  }
 catch (  Exception e1) {
    try {
      myMethod=type.getMethod(myMethodName,JsonFormat.class);
      Object re=myMethod.invoke(obj,format);
      writer.append(re.toString());
      return;
    }
 catch (    Exception e) {
    }
  }
  Mirror<?> me=Mirror.me(type);
  Field[] fields=me.getFields();
  appendBraceBegin();
  increaseFormatIndent();
  ArrayList<Pair> list=new ArrayList<Pair>(fields.length);
  for (  Field f : fields) {
    String name=f.getName();
    try {
      Object value=me.getValue(obj,f);
      if (!this.isIgnore(name,value))       list.add(new Pair(name,value));
    }
 catch (    FailToGetValueException e) {
    }
  }
  for (Iterator<Pair> it=list.iterator(); it.hasNext(); ) {
    Pair p=it.next();
    this.appendPair(p.name,p.value);
    if (it.hasNext())     this.appendPairEnd();
  }
  decreaseFormatIndent();
  appendBraceEnd();
}

Fixed version (ground truth):
private void pojo2Json(Object obj) throws IOException {
  if (null == obj)   return;
  Class<? extends Object> type=obj.getClass();
  ToJson tj=type.getAnnotation(ToJson.class);
  String myMethodName=Strings.sNull(null == tj ? null : tj.value(),"String_Node_Str");
  Method myMethod;
  try {
    myMethod=type.getMethod(myMethodName);
    Object re=myMethod.invoke(obj);
    writer.append(re.toString());
    return;
  }
 catch (  Exception e1) {
    try {
      myMethod=type.getMethod(myMethodName,JsonFormat.class);
      Object re=myMethod.invoke(obj,format);
      writer.append(re.toString());
      return;
    }
 catch (    Exception e) {
    }
  }
  Mirror<?> me=Mirror.me(type);
  Field[] fields=me.getFields();
  appendBraceBegin();
  increaseFormatIndent();
  ArrayList<Pair> list=new ArrayList<Pair>(fields.length);
  for (  Field f : fields) {
    String name=f.getName();
    try {
      Object value=me.getValue(obj,name);
      if (!this.isIgnore(name,value))       list.add(new Pair(name,value));
    }
 catch (    FailToGetValueException e) {
    }
  }
  for (Iterator<Pair> it=list.iterator(); it.hasNext(); ) {
    Pair p=it.next();
    this.appendPair(p.name,p.value);
    if (it.hasNext())     this.appendPairEnd();
  }
  decreaseFormatIndent();
  appendBraceEnd();
}
Program: 43677
Project: 43677
Buggy source:
private void buildSQLMaps(){
  sqlMaps=new HashMap<String,String>();
  if (null != paths)   for (  String path : paths) {
    if (null == path)     continue;
    InputStream stream=Files.findFileAsStream(path);
    if (stream != null) {
      Reader reader=null;
      try {
        reader=new InputStreamReader(stream);
        loadSQL(reader);
      }
 catch (      IOException e) {
        Logs.getLog(getClass()).warnf("String_Node_Str",e);
      }
 finally {
        Streams.safeClose(reader);
        Streams.safeClose(stream);
      }
    }
  }
}

Fixed version (ground truth):
private void buildSQLMaps() throws MalformedURLException, IOException {
  sqlMaps=new HashMap<String,String>();
  if (null != paths)   for (  String path : paths) {
    if (null == path)     continue;
    File f=Files.findFile(Strings.trim(path));
    if (f == null || (!f.exists())) {
      InputStream stream=ClassLoaderUtil.getStream(path);
      if (stream != null) {
        InputStreamReader reader=null;
        try {
          reader=new InputStreamReader(stream,"String_Node_Str");
          loadSQL(reader);
        }
  finally {
          Streams.safeClose(reader);
          Streams.safeClose(stream);
        }
      }
    }
 else {
      File[] files;
      if (f.isDirectory()) {
        files=f.listFiles(sqkFileFilter == null ? defaultSqkFileFilter : sqkFileFilter);
      }
 else       files=Lang.array(f);
      try {
        for (        File file : files) {
          Reader stream=Streams.fileInr(file);
          loadSQL(stream);
        }
      }
 catch (      Exception e) {
        throw Lang.wrapThrow(e);
      }
    }
  }
}
Program: 43678
Project: 43678
Buggy source:
@Test public void check_parse_comboSqls(){
  sqls=new FileSqlManager("String_Node_Str");
  ComboSql sql=sqls.createCombo();
  assertEquals(10,sql.count());
}

Fixed version (ground truth):
@Test public void check_parse_comboSqls(){
  SqlManager sqls=new FileSqlManager("String_Node_Str");
  ComboSql sql=sqls.createCombo();
  assertEquals(10,sql.count());
}
Program: 43679
Project: 43679
Buggy source:
@Test public void check_Query_SQL(){
  sqls=new FileSqlManager(PATH);
  Sql sql=sqls.create("String_Node_Str");
  assertTrue(sql.toString().toUpperCase().startsWith("String_Node_Str"));
}

Fixed version (ground truth):
@Test public void check_Query_SQL(){
  SqlManager sqls=new FileSqlManager(PATH);
  Sql sql=sqls.create("String_Node_Str");
  assertTrue(sql.toString().toUpperCase().startsWith("String_Node_Str"));
}
Program: 43680
Project: 43680
Buggy source:
@Test public void check_Update_SQL(){
  sqls=new FileSqlManager(PATH);
  Sql sql=sqls.create("String_Node_Str");
  assertTrue(sql.toString().toUpperCase().startsWith("String_Node_Str"));
}

Fixed version (ground truth):
@Test public void check_Update_SQL(){
  SqlManager sqls=new FileSqlManager(PATH);
  Sql sql=sqls.create("String_Node_Str");
  assertTrue(sql.toString().toUpperCase().startsWith("String_Node_Str"));
}
Program: 43681
Project: 43681
Buggy source:
@Test public void check_Fetch_SQL(){
  sqls=new FileSqlManager(PATH);
  Sql sql=sqls.create("String_Node_Str");
  assertTrue(sql.toString().toUpperCase().startsWith("String_Node_Str"));
}

Fixed version (ground truth):
@Test public void check_Fetch_SQL(){
  SqlManager sqls=new FileSqlManager(PATH);
  Sql sql=sqls.create("String_Node_Str");
  assertTrue(sql.toString().toUpperCase().startsWith("String_Node_Str"));
}
Program: 43682
Project: 43682
Buggy source:
@Test public void check_Create_SQL(){
  sqls=new FileSqlManager(PATH);
  Sql sql=sqls.create("String_Node_Str");
  assertTrue(sql.toString().toUpperCase().startsWith("String_Node_Str"));
}

Fixed version (ground truth):
@Test public void check_Create_SQL(){
  SqlManager sqls=new FileSqlManager(PATH);
  Sql sql=sqls.create("String_Node_Str");
  assertTrue(sql.toString().toUpperCase().startsWith("String_Node_Str"));
}
Program: 43683
Project: 43683
Buggy source:
@Test public void check_PersonTestSQLs(){
  sqls=new FileSqlManager("String_Node_Str");
  String[] keys={"String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str"};
  for (int i=0; i < keys.length; i++) {
    assertEquals(keys[i],sqls.keys()[i]);
  }
}

Fixed version (ground truth):
@Test public void check_PersonTestSQLs(){
  SqlManager sqls=new FileSqlManager("String_Node_Str");
  String[] keys={"String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str"};
  for (int i=0; i < keys.length; i++) {
    assertEquals(keys[i],sqls.keys()[i]);
  }
}
Program: 43684
Project: 43684
Buggy source:
@Test public void test_sqls_save() throws IOException {
  sqls=new FileSqlManager("String_Node_Str");
  int count=sqls.count();
  File f=Files.findFile("String_Node_Str");
  ((FileSqlManager)sqls).saveAs(f.getAbsolutePath());
  sqls=new FileSqlManager("String_Node_Str");
  assertEquals(count,sqls.count());
}

Fixed version (ground truth):
@Test public void test_sqls_save() throws IOException {
  SqlManager sqls=new FileSqlManager("String_Node_Str");
  int count=sqls.count();
  File f=Files.findFile("String_Node_Str");
  ((FileSqlManager)sqls).saveAs(f.getAbsolutePath());
  sqls=new FileSqlManager("String_Node_Str");
  assertEquals(count,sqls.count());
}
Program: 43685
Project: 43685
Buggy source:
@Test public void check_Insert_SQL(){
  sqls=new FileSqlManager(PATH);
  Sql sql=sqls.create("String_Node_Str");
  assertTrue(sql.toString().toUpperCase().startsWith("String_Node_Str"));
}

Fixed version (ground truth):
@Test public void check_Insert_SQL(){
  SqlManager sqls=new FileSqlManager(PATH);
  Sql sql=sqls.create("String_Node_Str");
  assertTrue(sql.toString().toUpperCase().startsWith("String_Node_Str"));
}
Program: 43686
Project: 43686
Buggy source:
@Test public void check_Count_SQL(){
  sqls=new FileSqlManager(PATH);
  assertEquals(10,sqls.count());
  String[] keys={"String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str"};
  for (int i=0; i < keys.length; i++) {
    assertEquals(keys[i],sqls.keys()[i]);
  }
}

Fixed version (ground truth):
@Test public void check_Count_SQL(){
  SqlManager sqls=new FileSqlManager(PATH);
  assertEquals(10,sqls.count());
  String[] keys={"String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str"};
  for (int i=0; i < keys.length; i++) {
    assertEquals(keys[i],sqls.keys()[i]);
  }
}
Program: 43687
Project: 43687
Buggy source:
public Object get(IocMaking ing){
  return ing.getIoc().get(type,name);
}

Fixed version (ground truth):
public Object get(IocMaking ing){
  Ioc ioc=ing.getIoc();
  if (ioc instanceof Ioc2)   return ((Ioc2)ioc).get(type,name,ing.getContext());
  return ioc.get(type,name);
}
Program: 43688
Project: 43688
Buggy source:
public boolean equals(Object obj){
  Project p=(Project)obj;
  return id == p.id & name.equals(p.name) & alias.equals(p.alias);
}

Fixed version (ground truth):
public boolean equals(Object obj){
  Project p=(Project)obj;
  return id == p.id && name.equals(p.name) && alias.equals(p.alias);
}
Program: 43690
Project: 43690
Buggy source:
private static String[] findInJar(String jarPath,Class<?> baseClass){
  try {
    jarPath=decodePath(jarPath);
    ZipEntry[] entrys=Files.findEntryInZip(new ZipFile(jarPath),baseClass.getPackage().getName().replace('.','/') + "String_Node_Str");
    if (null != entrys && entrys.length > 0) {
      String[] classNames=new String[entrys.length];
      for (int i=0; i < entrys.length; i++) {
        String ph=entrys[i].getName();
        classNames[i]=ph.substring(0,ph.lastIndexOf('.')).replaceAll("String_Node_Str","String_Node_Str");
      }
      return classNames;
    }
  }
 catch (  IOException e) {
  }
  return null;
}

Fixed version (ground truth):
private static String[] findInJar(String jarPath,Package packageA){
  try {
    jarPath=decodePath(jarPath);
    ZipEntry[] entrys=Files.findEntryInZip(new ZipFile(jarPath),packageA.getName().replace('.','/') + "String_Node_Str");
    if (null != entrys && entrys.length > 0) {
      String[] classNames=new String[entrys.length];
      for (int i=0; i < entrys.length; i++) {
        String ph=entrys[i].getName();
        classNames[i]=ph.substring(0,ph.lastIndexOf('.')).replaceAll("String_Node_Str","String_Node_Str");
      }
      return classNames;
    }
  }
 catch (  IOException e) {
  }
  return null;
}
Program: 43691
Project: 43691
Buggy source:
private static String[] findInClassPath(File dir,Class<?> classZ){
  try {
    File[] files=dir.listFiles(new FileFilter(){
      public boolean accept(      File pathname){
        return pathname.getName().endsWith("String_Node_Str");
      }
    }
);
    if (null != files && files.length > 0) {
      String[] classNames=new String[files.length];
      Package packageA=classZ.getPackage();
      for (int i=0; i < files.length; i++) {
        String fileName=files[i].getName();
        String classShortName=fileName.substring(0,fileName.length() - "String_Node_Str".length());
        classNames[i]=packageA.getName() + "String_Node_Str" + classShortName;
      }
      return classNames;
    }
  }
 catch (  SecurityException e) {
  }
  return null;
}

Fixed version (ground truth):
private static String[] findInClassPath(File dir,Package packageA){
  try {
    File[] files=dir.listFiles(new FileFilter(){
      public boolean accept(      File pathname){
        return pathname.getName().endsWith("String_Node_Str");
      }
    }
);
    if (null != files && files.length > 0) {
      String[] classNames=new String[files.length];
      for (int i=0; i < files.length; i++) {
        String fileName=files[i].getName();
        String classShortName=fileName.substring(0,fileName.length() - "String_Node_Str".length());
        classNames[i]=packageA.getName() + "String_Node_Str" + classShortName;
      }
      return classNames;
    }
  }
 catch (  SecurityException e) {
  }
  return null;
}
Program: 43692
Project: 43692
Buggy source:
/** 
 * It will list all Class object same package with the Class you give. Whatever the class file you give existed in normal directory or jar file.
 * @param baseClass
 * @return a class List
 */
public static List<Class<?>> scanClass(Class<?> baseClass){
  File dir=getBasePath(baseClass);
  if (dir == null)   return null;
  String[] classNames=null;
  String jarPath=getJarPath(dir);
  if (jarPath != null) {
    classNames=findInJar(jarPath,baseClass);
  }
 else   classNames=findInClassPath(dir,baseClass);
  if (classNames == null)   return null;
  List<Class<?>> list=new ArrayList<Class<?>>(classNames.length);
  for (  String className : classNames)   try {
    list.add(Class.forName(className));
  }
 catch (  Throwable e) {
  }
  return list;
}

Fixed version (ground truth):
/** 
 * It will list all Class object in the package you give. <p/>Whatever the class file you give existed in normal directory or jar file. <p/><b>Not working in GAE</b>
 * @return a class List
 * @throws NullPointerException when packageZ is null
 */
public static List<Class<?>> scanClass(File dir,Package packageZ){
  if (dir == null)   dir=Files.findFile(packageZ.getName().replaceAll("String_Node_Str","String_Node_Str"));
  String[] classNames=null;
  String jarPath=getJarPath(dir);
  if (jarPath != null) {
    classNames=findInJar(jarPath,packageZ);
  }
 else   classNames=findInClassPath(dir,packageZ);
  if (classNames == null)   return null;
  List<Class<?>> list=new ArrayList<Class<?>>(classNames.length);
  for (  String className : classNames)   try {
    list.add(Class.forName(className));
  }
 catch (  Throwable e) {
  }
  return list;
}
Program: 43694
Project: 43694
Buggy source:
private void load(Map<String,Map<String,Object>> map,File[] files){
  for (  File f : files) {
    if (f.isDirectory()) {
      loadFromDir(map,f);
    }
 else     if (f.isFile()) {
      map.putAll(buildMap(f));
    }
  }
}

Fixed version (ground truth):
private void load(Map<String,Map<String,Object>> map,File[] files){
  for (  File f : files) {
    if (f.isDirectory()) {
      loadFromDir(map,f);
    }
 else     if (f.isFile()) {
      Map<String,Map<String,Object>> fileMap=buildMap(f);
      if (null != fileMap && fileMap.size() > 0)       map.putAll(fileMap);
    }
  }
}
Program: 43695
Project: 43695
Buggy source:
private void unpackagePrivateData(Type type){
  if (type.equals(Type.BOOLEAN_TYPE)) {
    mv.visitMethodInsn(INVOKEVIRTUAL,"String_Node_Str","String_Node_Str","String_Node_Str");
  }
 else   if (type.equals(Type.BYTE_TYPE)) {
    mv.visitMethodInsn(INVOKEVIRTUAL,"String_Node_Str","String_Node_Str","String_Node_Str");
  }
 else   if (type.equals(Type.CHAR_TYPE)) {
    mv.visitMethodInsn(INVOKEVIRTUAL,"String_Node_Str","String_Node_Str","String_Node_Str");
  }
 else   if (type.equals(Type.SHORT_TYPE)) {
    mv.visitMethodInsn(INVOKEVIRTUAL,"String_Node_Str","String_Node_Str","String_Node_Str");
  }
 else   if (type.equals(Type.INT_TYPE)) {
    mv.visitMethodInsn(INVOKEVIRTUAL,"String_Node_Str","String_Node_Str","String_Node_Str");
  }
 else   if (type.equals(Type.LONG_TYPE)) {
    mv.visitMethodInsn(INVOKEVIRTUAL,"String_Node_Str","String_Node_Str","String_Node_Str");
  }
 else   if (type.equals(Type.FLOAT_TYPE)) {
    mv.visitMethodInsn(INVOKEVIRTUAL,"String_Node_Str","String_Node_Str","String_Node_Str");
  }
 else   if (type.equals(Type.DOUBLE_TYPE)) {
    mv.visitMethodInsn(INVOKEVIRTUAL,"String_Node_Str","String_Node_Str","String_Node_Str");
  }
}

Fixed version (ground truth):
private void unpackagePrivateData(Type type){
  if (type.equals(Type.BOOLEAN_TYPE)) {
    mv.visitMethodInsn(INVOKESTATIC,"String_Node_Str","String_Node_Str","String_Node_Str");
  }
 else   if (type.equals(Type.BYTE_TYPE)) {
    mv.visitMethodInsn(INVOKESTATIC,"String_Node_Str","String_Node_Str","String_Node_Str");
  }
 else   if (type.equals(Type.CHAR_TYPE)) {
    mv.visitMethodInsn(INVOKESTATIC,"String_Node_Str","String_Node_Str","String_Node_Str");
  }
 else   if (type.equals(Type.SHORT_TYPE)) {
    mv.visitMethodInsn(INVOKESTATIC,"String_Node_Str","String_Node_Str","String_Node_Str");
  }
 else   if (type.equals(Type.INT_TYPE)) {
    mv.visitMethodInsn(INVOKESTATIC,"String_Node_Str","String_Node_Str","String_Node_Str");
  }
 else   if (type.equals(Type.LONG_TYPE)) {
    mv.visitMethodInsn(INVOKESTATIC,"String_Node_Str","String_Node_Str","String_Node_Str");
  }
 else   if (type.equals(Type.FLOAT_TYPE)) {
    mv.visitMethodInsn(INVOKESTATIC,"String_Node_Str","String_Node_Str","String_Node_Str");
  }
 else   if (type.equals(Type.DOUBLE_TYPE)) {
    mv.visitMethodInsn(INVOKESTATIC,"String_Node_Str","String_Node_Str","String_Node_Str");
  }
}
Program: 43696
Project: 43696
Buggy source:
public Link(Mirror<?> mirror,Field field,ManyMany mm,boolean fromName,boolean toName){
  this.ownField=field;
  this.type=LinkType.ManyMany;
  this.mapKeyField="String_Node_Str".equals(mm.key()) ? null : mm.key();
  this.targetClass=mm.target();
  this.from=mm.from();
  this.to=mm.to();
  this.relation=Relation.make(mm.relation());
  this.referField=lookupKeyField(mirror,fromName);
  this.targetField=lookupKeyField(Mirror.me(targetClass),toName);
  if (null == this.referField || null == this.targetField) {
    throw Lang.makeThrow("String_Node_Str" + "String_Node_Str" + "String_Node_Str",mirror.getType().getName(),field.getName(),targetClass.getName(),referField,targetField);
  }
}

Fixed version (ground truth):
@Deprecated public Link(Mirror<?> mirror,Field field,ManyMany mm,boolean fromName,boolean toName){
  this.ownField=field;
  this.type=LinkType.ManyMany;
  this.mapKeyField="String_Node_Str".equals(mm.key()) ? null : mm.key();
  this.targetClass=mm.target();
  this.from=mm.from();
  this.to=mm.to();
  this.relation=Relation.make(mm.relation());
  this.referField=lookupKeyField(mirror,fromName);
  this.targetField=lookupKeyField(Mirror.me(targetClass),toName);
  if (null == this.referField || null == this.targetField) {
    throw Lang.makeThrow("String_Node_Str" + "String_Node_Str" + "String_Node_Str",mirror.getType().getName(),field.getName(),targetClass.getName(),referField,targetField);
  }
}
Program: 43697
Project: 43697
Buggy source:
private Link evalLink(DatabaseMeta db,Connection conn,Mirror<?> mirror,Field field){
  try {
    One one=field.getAnnotation(One.class);
    if (null != one) {
      return new Link(mirror,field,one);
    }
 else {
      Many many=field.getAnnotation(Many.class);
      if (null != many) {
        return new Link(mirror,field,many);
      }
 else {
        ManyMany mm=field.getAnnotation(ManyMany.class);
        if (null != mm) {
          Statement stat=null;
          ResultSet rs=null;
          ResultSetMetaData rsmd=null;
          boolean fromName=false;
          boolean toName=false;
          try {
            stat=conn.createStatement();
            Segment tableName=new CharSegment(mm.relation());
            rs=stat.executeQuery(db.getResultSetMetaSql(TableName.render(tableName)));
            rsmd=rs.getMetaData();
            fromName=!Daos.isIntLikeColumn(rsmd,mm.from());
            toName=!Daos.isIntLikeColumn(rsmd,mm.to());
          }
 catch (          Exception e) {
            if (log.isWarnEnabled())             log.warnf("String_Node_Str" + "String_Node_Str",mm.relation(),mm.from(),mm.to());
          }
 finally {
            Daos.safeClose(stat,rs);
          }
          return new Link(mirror,field,mm,fromName,toName);
        }
      }
    }
  }
 catch (  Exception e) {
    throw Lang.makeThrow("String_Node_Str",field.getName(),mirror.getType().getName(),e.getMessage());
  }
  return null;
}

Fixed version (ground truth):
private Link evalLink(DatabaseMeta db,Connection conn,Mirror<?> mirror,Field field){
  try {
    One one=field.getAnnotation(One.class);
    if (null != one) {
      return Link.getLinkForOne(mirror,field,one.target(),one.field());
    }
 else {
      Many many=field.getAnnotation(Many.class);
      if (null != many) {
        return Link.getLinkForMany(mirror,field,many.target(),many.field(),many.key());
      }
 else {
        ManyMany mm=field.getAnnotation(ManyMany.class);
        if (null != mm) {
          Statement stat=null;
          ResultSet rs=null;
          ResultSetMetaData rsmd=null;
          boolean fromName=false;
          boolean toName=false;
          try {
            stat=conn.createStatement();
            Segment tableName=new CharSegment(mm.relation());
            rs=stat.executeQuery(db.getResultSetMetaSql(TableName.render(tableName)));
            rsmd=rs.getMetaData();
            fromName=!Daos.isIntLikeColumn(rsmd,mm.from());
            toName=!Daos.isIntLikeColumn(rsmd,mm.to());
          }
 catch (          Exception e) {
            if (log.isWarnEnabled())             log.warnf("String_Node_Str" + "String_Node_Str",mm.relation(),mm.from(),mm.to());
          }
 finally {
            Daos.safeClose(stat,rs);
          }
          return Link.getLinkForManyMany(mirror,field,mm.target(),mm.key(),mm.from(),mm.to(),mm.relation(),fromName,toName);
        }
      }
    }
  }
 catch (  Exception e) {
    throw Lang.makeThrow("String_Node_Str",field.getName(),mirror.getType().getName(),e.getMessage());
  }
  return null;
}
Program: 43698
Project: 43698
Buggy source:
public NutFilePool(String homePath,int size){
  this.size=size;
  home=Files.findFile(homePath);
  if (null == home) {
    home=new File(homePath);
    try {
      Files.makeDir(home);
    }
 catch (    IOException e) {
      throw Lang.wrapThrow(e);
    }
  }
  if (!home.isDirectory())   throw Lang.makeThrow("String_Node_Str",homePath,this.getClass().getName());
  File last=home;
  String[] subs=null;
  while (last.isDirectory()) {
    subs=last.list(new FilenameFilter(){
      public boolean accept(      File dir,      String name){
        return name.matches("String_Node_Str");
      }
    }
);
    if (null != subs && subs.length > 0) {
      last=new File(last.getAbsolutePath() + "String_Node_Str" + subs[subs.length - 1]);
      if (last.isFile()) {
        cursor=Pools.getFileId(home,last);
        break;
      }
    }
 else {
      break;
    }
  }
}

Fixed version (ground truth):
public NutFilePool(String homePath,int size){
  this.size=size;
  try {
    home=Files.createIfNoExists(homePath);
  }
 catch (  IOException e) {
    throw Lang.wrapThrow(e);
  }
  if (null == home) {
    home=new File(homePath);
    Files.makeDir(home);
  }
  if (!home.isDirectory())   throw Lang.makeThrow("String_Node_Str",homePath,this.getClass().getName());
  File last=home;
  String[] subs=null;
  while (last.isDirectory()) {
    subs=last.list(new FilenameFilter(){
      public boolean accept(      File dir,      String name){
        return name.matches("String_Node_Str");
      }
    }
);
    if (null != subs && subs.length > 0) {
      last=new File(last.getAbsolutePath() + "String_Node_Str" + subs[subs.length - 1]);
      if (last.isFile()) {
        cursor=Pools.getFileId(home,last);
        break;
      }
    }
 else {
      break;
    }
  }
}
Program: 43699
Project: 43699
Buggy source:
/** 
 * 创建新目录，如果父目录不存在，也一并创建。可接受 null 参数
 * @param dir 目录对象
 * @return false，如果目录已存在。 true 创建成功
 * @throws IOException
 */
public static boolean makeDir(File dir) throws IOException {
  if (null == dir)   return false;
  if (dir.exists())   return false;
  return dir.mkdirs();
}

Fixed version (ground truth):
/** 
 * 创建新目录，如果父目录不存在，也一并创建。可接受 null 参数
 * @param dir 目录对象
 * @return false，如果目录已存在。 true 创建成功
 * @throws IOException
 */
public static boolean makeDir(File dir){
  if (null == dir)   return false;
  if (dir.exists())   return false;
  return dir.mkdirs();
}
Program: 43700
Project: 43700
Buggy source:
/** 
 * 从 CLASSPATH 下寻找一个文件
 * @param path 文件路径
 * @return 文件对象，如果不存在，则为 null
 */
public static File findFile(String path){
  return findFile(path,Files.class,Charset.defaultCharset().name());
}

Fixed version (ground truth):
/** 
 * 从 CLASSPATH 下寻找一个文件
 * @param path 文件路径
 * @return 文件对象，如果不存在，则为 null
 */
public static File findFile(String path){
  return findFile(path,Files.class.getClassLoader(),Charset.defaultCharset().name());
}
Program: 43701
Project: 43701
Buggy source:
/** 
 * 将文件改名
 * @param src 文件
 * @param newName 新名称
 * @return 改名是否成功
 */
public static boolean rename(File src,String newName){
  if (src == null || newName == null)   return false;
  if (src.exists()) {
    File newFile=new File(src.getParent() + "String_Node_Str" + newName);
    if (newFile.exists())     return false;
    try {
      Files.makeDir(newFile.getParentFile());
    }
 catch (    IOException e) {
      return false;
    }
    return src.renameTo(newFile);
  }
  return false;
}

Fixed version (ground truth):
/** 
 * 将文件改名
 * @param src 文件
 * @param newName 新名称
 * @return 改名是否成功
 */
public static boolean rename(File src,String newName){
  if (src == null || newName == null)   return false;
  if (src.exists()) {
    File newFile=new File(src.getParent() + "String_Node_Str" + newName);
    if (newFile.exists())     return false;
    Files.makeDir(newFile.getParentFile());
    return src.renameTo(newFile);
  }
  return false;
}
Program: 43702
Project: 43702
Buggy source:
public Context(){
  this.map=new HashMap<String,Object>();
}

Fixed version (ground truth):
public Context(Map<String,Object> map){
  this.map=map;
}
Program: 43704
Project: 43704
Buggy source:
public DefaultLoading(ServletConfig config){
  this.config=config;
}

Fixed version (ground truth):
public DefaultLoading(ServletConfig config){
  this.config=config;
  context=new Context();
  saveRootPathToContext(config);
  if (log.isDebugEnabled()) {
    log.debugf("String_Node_Str",Json.toJson(context,JsonFormat.nice()));
  }
}
Program: 43705
Project: 43705
Buggy source:
private void _insertSelf(Entity<?> entity,Object obj){
  if (null != entity.getBefores())   for (  FieldQuery nq : entity.getBefores())   nq.update(this,obj);
  Sql sql=sqlMaker.insert(entity,obj);
  execute(sql);
  if (null != entity.getAfters())   for (  FieldQuery nq : entity.getAfters())   nq.update(this,obj);
}

Fixed version (ground truth):
private void _insertSelf(Entity<?> entity,Object obj){
  runFieldQuery(entity.getBefores(),obj);
  execute(sqlMaker.insert(entity,obj));
  runFieldQuery(entity.getAfters(),obj);
}
Program: 43706
Project: 43706
Buggy source:
public <T>T fastInsert(T obj){
  if (Lang.length(obj) > 0) {
    Object first=Lang.first(obj);
    final Entity<?> entity=this.getEntity(first.getClass());
    Lang.each(obj,new Each<Object>(){
      public void invoke(      int i,      Object ele,      int length){
        execute(sqlMaker.insert(entity,ele));
      }
    }
);
  }
  return obj;
}

Fixed version (ground truth):
public <T>T fastInsert(T obj){
  if (Lang.length(obj) > 0) {
    Object first=Lang.first(obj);
    final Entity<?> entity=this.getEntity(first.getClass());
    Lang.each(obj,new Each<Object>(){
      public void invoke(      int i,      Object ele,      int length){
        runFieldQuery(entity.getBefores(),ele);
        execute(sqlMaker.insert(entity,ele));
      }
    }
);
  }
  return obj;
}
Program: 43707
Project: 43707
Buggy source:
/** 
 * 获取一个路径的绝对路径
 * @param path 路径
 * @param klassLoader 参考 ClassLoader
 * @param enc 路径编码方式
 * @return 绝对路径
 */
public static String absolute(String path,ClassLoader klassLoader,String enc){
  path=normalize(path,enc);
  if (null == path || path.length() == 0)   return null;
  File f=new File(path);
  if (!f.exists()) {
    URL url=klassLoader.getResource(path);
    if (null == url)     url=ClassLoader.getSystemResource(path);
    if (null != url) {
      return url.getPath();
    }
    return null;
  }
  return path;
}

Fixed version (ground truth):
/** 
 * 获取一个路径的绝对路径
 * @param path 路径
 * @param klassLoader 参考 ClassLoader
 * @param enc 路径编码方式
 * @return 绝对路径
 */
public static String absolute(String path,ClassLoader klassLoader,String enc){
  path=normalize(path,enc);
  if (null == path || path.length() == 0)   return null;
  File f=new File(path);
  if (!f.exists()) {
    URL url=klassLoader.getResource(path);
    if (null == url)     url=ClassLoader.getSystemResource(path);
    if (null != url)     return normalize(url.getPath(),enc);
    return null;
  }
  return path;
}
Program: 43708
Project: 43708
Buggy source:
public Entity(){
  fields=new HashMap<String,EntityField>();
  links=new LinkedList<Link>();
  _ln_cache=new HashMap<String,List<Link>>();
}

Fixed version (ground truth):
public Entity(){
  super();
  fields=new HashMap<String,EntityField>();
  links=new LinkedList<Link>();
  _ln_cache=new HashMap<String,List<Link>>();
}
Program: 43709
Project: 43709
Buggy source:
public EntityField(Entity<?> entity,Field field){
  if (null != entity && null != field) {
    this.mirror=Mirror.me(field.getType());
    this.entity=entity;
    this.field=field;
    try {
      getter=entity.getMirror().getGetter(field);
      getter.setAccessible(true);
    }
 catch (    NoSuchMethodException e) {
    }
    try {
      setter=entity.getMirror().getSetter(field);
      setter.setAccessible(true);
    }
 catch (    NoSuchMethodException e) {
    }
  }
}

Fixed version (ground truth):
public EntityField(Entity<?> entity,Field field){
  super();
  if (null != entity && null != field) {
    this.mirror=Mirror.me(field.getType());
    this.entity=entity;
    this.field=field;
    try {
      getter=entity.getMirror().getGetter(field);
      getter.setAccessible(true);
    }
 catch (    NoSuchMethodException e) {
    }
    try {
      setter=entity.getMirror().getSetter(field);
      setter.setAccessible(true);
    }
 catch (    NoSuchMethodException e) {
    }
  }
}
Program: 43710
Project: 43710
Buggy source:
protected NutIoc(ObjectMaker maker,IocLoader loader,IocContext context,String defaultScope){
  this.maker=maker;
  this.defaultScope=defaultScope;
  this.context=context;
  if (loader instanceof CachedIocLoader)   this.loader=loader;
 else   this.loader=CachedIocLoaderImpl.create(loader);
  vpms=new ArrayList<ValueProxyMaker>(5);
  addValueProxyMaker(new DefaultValueProxyMaker());
  mirrors=new DefaultMirrorFactory(this);
}

Fixed version (ground truth):
protected NutIoc(ObjectMaker maker,IocLoader loader,IocContext context,String defaultScope,MirrorFactory mirrors){
  this.maker=maker;
  this.defaultScope=defaultScope;
  this.context=context;
  if (loader instanceof CachedIocLoader)   this.loader=loader;
 else   this.loader=CachedIocLoaderImpl.create(loader);
  vpms=new ArrayList<ValueProxyMaker>(5);
  addValueProxyMaker(new DefaultValueProxyMaker());
  if (mirrors == null)   this.mirrors=new DefaultMirrorFactory(this);
 else   this.mirrors=mirrors;
}
Program: 43711
Project: 43711
Buggy source:
public static Link getLinkForOne(Field field,Class<?> targetClass,Field referField,Field targetField) throws NoSuchFieldException {
  Link link=new Link(field,targetClass,LinkType.One,referField,targetField);
  return link;
}

Fixed version (ground truth):
/** 
 * 创建一条一对一的映射，将<b>本 POJO</b> 的一个字段通过本身的一个参考字段指向<b>目标POJO</b>的主键。 <p> <b style=color:red>这里需要注意的是：</b><br> 你的 <b>本 POJO</b>的参考字段类型要同<b>目标POJO</b>的主键要对应。即， <ul> <li><b>目标POJO</b>不可以是复合主键 <li>如果你的 <b>本 POJO</b>参考字段类型是整数，<b>目标POJO</b>的主键就必须是整数型主键。 <li>如果你的 <b>本 POJO</b>参考字段类型是字符串，<b>目标POJO</b>的主键就必须是字符型主键 </ul>
 * @param mirror <b>本 POJO</b>的类型
 * @param field 被映射的字段，它的类型应该是<b>目标POJO</b>的类型的接口或者超类
 * @param targetClass <b>目标POJO</b>的类型
 * @param referFld <b>本 POJO</b>的参考字段
 * @param targetPkFld <b>目标POJO</b>的主键
 * @return 映射对象
 */
public static Link getLinkForOne(Mirror<?> mirror,Field field,Class<?> targetClass,Field referFld,Field targetPkFld){
  Link link=new Link(field,targetClass);
  link.type=LinkType.One;
  link.referField=referFld;
  link.targetField=targetPkFld;
  return link;
}
Program: 43712
Project: 43712
Buggy source:
public static Link getLinkForMany(Field field,Class<?> targetClass,Field referField,Field targetField,String key) throws NoSuchFieldException {
  Link link=new Link(field,targetClass,LinkType.Many,referField,targetField);
  link.mapKeyField="String_Node_Str".equals(key) ? null : key;
  return link;
}

Fixed version (ground truth):
/** 
 * 创建一条一对多的映射，将<b>本 POJO</b> 的一个字段通过<b>目标POJO</b>一个参考字段指向本身的主键。 因此<b>本 POJO</b>的这个映射字段可以是一个集合或数组，因为可能有多个<b>目标POJO</b>指向自己 <p> <b style=color:red>这里需要注意的是：</b><br> 你的 <b>目标POJO</b>的参考字段类型要同<b>本POJO</b>的主键要对应。即， <ul> <li><b>本POJO</b>不可以是复合主键 <li>如果你的 <b>目标 POJO</b>参考字段类型是整数，<b>本POJO</b>的主键就必须是整数型主键。 <li>如果你的 <b>目标 POJO</b>参考字段类型是字符串，<b>本POJO</b>的主键就必须是字符型主键 <li>如果 referField 为 null，则将映射 <b>目标 POJO</b>的全部集合 -- 比较适用于枚举类型。 </ul>
 * @param mirror <b>本 POJO</b>的类型
 * @param field 被映射的字段，它的类型应该是<b>目标POJO</b>的类型的接口或者超类
 * @param targetClass <b>目标POJO</b>的类型
 * @param targetReferFld <b>本 POJO</b>主键
 * @param pkFld <b>目标POJO</b>的参考字段
 * @param key 如果被映射字段是个 Map， 你需要声明一下，<b>目标POJO</b>哪个字段是用来作为键值的。 默认的，赋值 null 即可
 * @return 映射对象
 */
public static Link getLinkForMany(Mirror<?> mirror,Field field,Class<?> targetClass,Field targetReferFld,Field pkFld,String key){
  Link link=new Link(field,targetClass);
  link.type=LinkType.Many;
  link.mapKeyField=Strings.isBlank(key) ? null : key;
  link.targetField=targetReferFld;
  link.referField=pkFld;
  return link;
}