nus-yam/ex-repair huggingface dataset:
Program: 37589
Project: 37589
Buggy source:
@Test public void clearingFields() throws InterruptedException {
  OfflineHelper.deleteDatabase(syncano.getAndroidContext(),SomeV2.class);
  createClass(SomeV2.class);
  SomeV2 obj=SomeV2.generateObject();
  assertTrue(obj.save().isSuccess());
  obj.clearField(SomeV2.FIELD_DATE).save();
  assertNull(obj.someDate);
  obj=SomeV2.generateObject();
  assertTrue(obj.saveDownloadedDataToStorage(true).save().isSuccess());
  obj.clearField(SomeV2.FIELD_DATE).mode(OfflineMode.LOCAL).save();
  assertNull(obj.someDate);
}

Fixed version (ground truth):
@Test public void clearingFields() throws InterruptedException {
  OfflineHelper.deleteDatabase(syncano.getAndroidContext(),SomeV2.class);
  createClass(SomeV2.class);
  SomeV2 obj=SomeV2.generateObject();
  assertTrue(obj.save().isSuccess());
  obj.clearField(SomeV2.FIELD_DATE).save();
  assertNull(obj.someDate);
  assertFalse(obj.hasAnyFieldsToClear());
  obj=SomeV2.generateObject();
  assertTrue(obj.saveDownloadedDataToStorage(true).save().isSuccess());
  obj.clearField(SomeV2.FIELD_DATE).mode(OfflineMode.LOCAL).save();
  assertNull(obj.someDate);
  assertFalse(obj.hasAnyFieldsToClear());
  obj=SomeV2.generateObject();
  assertTrue(obj.saveDownloadedDataToStorage(true).save().isSuccess());
  final CountDownLatch latch=new CountDownLatch(1);
  obj.clearField(SomeV2.FIELD_DATE).mode(OfflineMode.LOCAL_ONLINE_IN_BACKGROUND).backgroundCallback(new SyncanoCallback<SomeV2>(){
    @Override public void success(    Response<SomeV2> response,    SomeV2 result){
      assertNull(result.someDate);
      assertFalse(result.hasAnyFieldsToClear());
      latch.countDown();
    }
    @Override public void failure(    Response<SomeV2> response){
      fail();
    }
  }
).save();
  assertNull(obj.someDate);
  latch.await(10,TimeUnit.SECONDS);
  assertEquals(0,latch.getCount());
  obj=SomeV2.generateObject();
  assertTrue(obj.saveDownloadedDataToStorage(true).save().isSuccess());
  Response<SomeV2> resp=obj.clearField(SomeV2.FIELD_DATE).mode(OfflineMode.LOCAL_WHEN_ONLINE_FAILED).save();
  assertNull(obj.someDate);
  assertFalse(obj.hasAnyFieldsToClear());
  assertFalse(resp.isDataFromLocalStorage());
  obj=SomeV2.generateObject();
  assertTrue(obj.saveDownloadedDataToStorage(true).save().isSuccess());
  new SyncanoBuilder().instanceName("String_Node_Str").apiKey("String_Node_Str").androidContext(getContext()).setAsGlobalInstance(true).build();
  resp=obj.clearField(SomeV2.FIELD_DATE).mode(OfflineMode.LOCAL_WHEN_ONLINE_FAILED).save();
  assertNull(obj.someDate);
  assertFalse(obj.hasAnyFieldsToClear());
  assertTrue(resp.isDataFromLocalStorage());
}
Program: 37590
Project: 37590
Buggy source:
@Override public void success(ResponseGetList<SomeV2> response,List<SomeV2> result){
  assertEquals(number,result.size());
}

Fixed version (ground truth):
@Override public void success(Response<SomeV2> response,SomeV2 result){
  assertNull(result.someDate);
  assertFalse(result.hasAnyFieldsToClear());
  latch.countDown();
}
Program: 37591
Project: 37591
Buggy source:
@Override public void failure(ResponseGetList<SomeV2> response){
  fail();
}

Fixed version (ground truth):
@Override public void failure(Response<SomeV2> response){
  fail();
}
Program: 37592
Project: 37592
Buggy source:
private InputStream getStringFieldsInputStream() throws IOException {
  ByteArrayOutputStream baos=new ByteArrayOutputStream();
  JsonObject json=gson.toJsonTree(data).getAsJsonObject();
  ((SyncanoObject)data).getIncrementBuilder().build(json);
  for (  Map.Entry<String,JsonElement> entry : json.entrySet()) {
    baos.write((twoHyphens + boundary + lineEnd).getBytes(UTF8));
    baos.write(("String_Node_Str" + entry.getKey() + "String_Node_Str"+ lineEnd).getBytes(UTF8));
    baos.write(("String_Node_Str" + lineEnd).getBytes(UTF8));
    baos.write(lineEnd.getBytes(UTF8));
    baos.write((GsonParser.getJsonElementAsString(entry.getValue())).getBytes(UTF8));
    baos.write(lineEnd.getBytes(UTF8));
  }
  ((SyncanoObject)data).resetRequestBuildingFields();
  return new ByteArrayInputStream(baos.toByteArray());
}

Fixed version (ground truth):
private InputStream getStringFieldsInputStream() throws IOException {
  ByteArrayOutputStream baos=new ByteArrayOutputStream();
  JsonObject json=gson.toJsonTree(data).getAsJsonObject();
  ((SyncanoObject)data).getIncrementBuilder().build(json);
  for (  Map.Entry<String,JsonElement> entry : json.entrySet()) {
    baos.write((twoHyphens + boundary + lineEnd).getBytes(UTF8));
    baos.write(("String_Node_Str" + entry.getKey() + "String_Node_Str"+ lineEnd).getBytes(UTF8));
    baos.write(("String_Node_Str" + lineEnd).getBytes(UTF8));
    baos.write(lineEnd.getBytes(UTF8));
    baos.write((GsonParser.getJsonElementAsString(entry.getValue())).getBytes(UTF8));
    baos.write(lineEnd.getBytes(UTF8));
  }
  return new ByteArrayInputStream(baos.toByteArray());
}
Program: 37593
Project: 37593
Buggy source:
protected SendRequest(Class<T> resultType,String url,Syncano syncano,Object data){
  super(resultType,url,syncano);
  updateGivenObject(false);
  this.data=data;
  if (data != null) {
    gson=GsonParser.createGson(data);
  }
 else {
    gson=GsonParser.createGson(resultType);
  }
}

Fixed version (ground truth):
protected SendRequest(Class<T> resultType,String url,Syncano syncano,Object data){
  super(resultType,url,syncano);
  updateGivenObject(false);
  this.data=data;
  if (data != null) {
    gson=GsonParser.createGson(data);
  }
 else {
    gson=GsonParser.createGson(resultType);
  }
  super.setRunAfter(clearFieldsRunAfter);
}
Program: 37594
Project: 37594
Buggy source:
@Override public Response<T> send(){
  return doOnlineRequest(onlineRequest,cleanStorageOnSuccessDownload,saveDownloadedDataToStorage);
}

Fixed version (ground truth):
@Override public Response<T> send(){
  Response<T> response=doOnlineRequest(onlineRequest,cleanStorageOnSuccessDownload,saveDownloadedDataToStorage);
  afterRequests(onlineRequest);
  return response;
}
Program: 37595
Project: 37595
Buggy source:
@Override public Response<T> doLocalRequest(ResultRequest<T> request){
  SyncanoObject data=request.getResultObject();
  if (data == null) {
    throw new RuntimeException("String_Node_Str");
  }
  if (data.getIncrementBuilder().hasAdditionFields()) {
    Log.e(OfflineSaveRequest.class.getSimpleName(),"String_Node_Str");
  }
  if (data.getId() == null || data.getId() == 0) {
    data.setId(null);
  }
  Context ctx=getSyncano().getAndroidContext();
  OfflineHelper.writeObjects(ctx,Collections.singletonList(data),request.getResultType());
  Response<T> response=new Response<>();
  response.setData((T)data).setDataFromLocalStorage(true).setResultCode(Response.CODE_SUCCESS);
  return response;
}

Fixed version (ground truth):
@Override public Response<T> doLocalRequest(ResultRequest<T> request){
  SyncanoObject data=request.getResultObject();
  if (data == null) {
    throw new RuntimeException("String_Node_Str");
  }
  if (data.getIncrementBuilder().hasAdditionFields()) {
    Log.e(OfflineSaveRequest.class.getSimpleName(),"String_Node_Str");
  }
  Collection<Field> fields=SyncanoClassHelper.findAllSyncanoFields(data.getClass());
  for (  Field f : fields) {
    if (data.isOnClearList(SyncanoClassHelper.getFieldName(f))) {
      f.setAccessible(true);
      try {
        f.set(data,null);
      }
 catch (      IllegalAccessException e) {
        e.printStackTrace();
      }
    }
  }
  if (data.getId() == null || data.getId() == 0) {
    data.setId(null);
  }
  Context ctx=getSyncano().getAndroidContext();
  OfflineHelper.writeObjects(ctx,Collections.singletonList(data),request.getResultType());
  Response<T> response=new Response<>();
  response.setData((T)data).setDataFromLocalStorage(true).setResultCode(Response.CODE_SUCCESS);
  return response;
}
Program: 37596
Project: 37596
Buggy source:
@Test public void testClearing() throws InterruptedException {
  createClass(Author.class);
  createClass(AllTypesObject.class);
  AllTypesObject obj=new AllTypesObject();
  assertTrue(obj.save().isSuccess());
  AllTypesObject.generateObject(obj);
  assertTrue(obj.someReference.save().isSuccess());
  obj.reference=obj;
  assertTrue(obj.save().isSuccess());
  obj.clearAll();
  assertTrue(obj.save().isSuccess());
  obj.checkEquals(new AllTypesObject(),false);
}

Fixed version (ground truth):
@Test public void testClearing() throws InterruptedException {
  createClass(Author.class);
  createClass(AllTypesObject.class);
  AllTypesObject obj=new AllTypesObject();
  assertTrue(obj.save().isSuccess());
  AllTypesObject.generateObject(obj);
  assertTrue(obj.someReference.save().isSuccess());
  obj.reference=obj;
  assertTrue(obj.save().isSuccess());
  obj.clearAll();
  assertTrue(obj.save().isSuccess());
  obj.checkEquals(new AllTypesObject(),false);
  assertFalse(obj.hasAnyFieldsToClear());
}
Program: 37597
Project: 37597
Buggy source:
public static void saveUserToStorage(Syncano syncano,AbstractUser user){
  if (syncano.getAndroidContext() == null || !(PlatformType.get() instanceof PlatformType.AndroidPlatform)) {
    return;
  }
  SharedPreferences prefs=syncano.getAndroidContext().getSharedPreferences(Syncano.class.getSimpleName(),Context.MODE_PRIVATE);
  SharedPreferences.Editor editor=prefs.edit();
  if (user == null) {
    editor.remove(dataKey(syncano));
    editor.remove(typeKey(syncano));
  }
 else {
    GsonParser.GsonParseConfig config=new GsonParser.GsonParseConfig();
    config.serializeReadOnlyFields=true;
    Gson gson=GsonParser.createGson(config);
    editor.putString(dataKey(syncano),gson.toJson(user));
    editor.putString(typeKey(syncano),user.getClass().getName());
  }
  editor.apply();
}

Fixed version (ground truth):
public static void saveUserToStorage(Syncano syncano,AbstractUser user){
  if (syncano.getAndroidContext() == null || !(PlatformType.get() instanceof PlatformType.AndroidPlatform)) {
    return;
  }
  SharedPreferences prefs=syncano.getAndroidContext().getSharedPreferences(Syncano.class.getSimpleName(),Context.MODE_PRIVATE);
  SharedPreferences.Editor editor=prefs.edit();
  if (user == null) {
    editor.remove(dataKey(syncano));
    editor.remove(typeKey(syncano));
  }
 else {
    GsonParser.GsonParseConfig config=new GsonParser.GsonParseConfig();
    config.serializeReadOnlyFields=true;
    Gson gson=GsonParser.createGson(user.getClass(),config);
    editor.putString(dataKey(syncano),gson.toJson(user));
    editor.putString(typeKey(syncano),user.getClass().getName());
  }
  editor.apply();
}
Program: 37598
Project: 37598
Buggy source:
public static <T>Gson createGson(final T object,GsonParseConfig config){
  GsonBuilder gsonBuilder=new GsonBuilder();
  gsonBuilder.registerTypeAdapter(NanosDate.class,new DateSerializer());
  gsonBuilder.registerTypeAdapter(NanosDate.class,new DateDeserializer());
  gsonBuilder.registerTypeAdapter(Date.class,new DateSerializer());
  gsonBuilder.registerTypeAdapter(Date.class,new DateDeserializer());
  gsonBuilder.registerTypeAdapter(SyncanoHashSet.class,new SyncanoHashSetDeserializer());
  gsonBuilder.registerTypeAdapter(SyncanoHashSet.class,new SyncanoHashSetSerializer());
  gsonBuilder.registerTypeAdapter(SyncanoFile.class,new FileDeserializer());
  gsonBuilder.setFieldNamingStrategy(new SyncanoFieldNamingStrategy());
  gsonBuilder.registerTypeHierarchyAdapter(SyncanoObject.class,new SyncanoObjectDeserializer(object));
  gsonBuilder.registerTypeHierarchyAdapter(SyncanoObject.class,new SyncanoObjectSerializer());
  if (object != null && !(object instanceof SyncanoObject)) {
    gsonBuilder.registerTypeAdapter(object.getClass(),new InstanceCreator<T>(){
      @Override public T createInstance(      Type type){
        return object;
      }
    }
);
  }
  return gsonBuilder.create();
}

Fixed version (ground truth):
public static <T>Gson createGson(final T object,GsonParseConfig config){
  GsonBuilder gsonBuilder=new GsonBuilder();
  gsonBuilder.registerTypeAdapter(NanosDate.class,new DateSerializer());
  gsonBuilder.registerTypeAdapter(NanosDate.class,new DateDeserializer());
  gsonBuilder.registerTypeAdapter(Date.class,new DateSerializer());
  gsonBuilder.registerTypeAdapter(Date.class,new DateDeserializer());
  gsonBuilder.registerTypeAdapter(SyncanoHashSet.class,new SyncanoHashSetDeserializer());
  gsonBuilder.registerTypeAdapter(SyncanoHashSet.class,new SyncanoHashSetSerializer());
  gsonBuilder.registerTypeAdapter(SyncanoFile.class,new FileDeserializer());
  gsonBuilder.setFieldNamingStrategy(new SyncanoFieldNamingStrategy());
  gsonBuilder.registerTypeHierarchyAdapter(SyncanoObject.class,new SyncanoObjectDeserializer(object));
  gsonBuilder.registerTypeHierarchyAdapter(SyncanoObject.class,new SyncanoObjectSerializer(config.serializeReadOnlyFields));
  if (object != null && !(object instanceof SyncanoObject)) {
    gsonBuilder.registerTypeAdapter(object.getClass(),new InstanceCreator<T>(){
      @Override public T createInstance(      Type type){
        return object;
      }
    }
);
  }
  return gsonBuilder.create();
}
Program: 37599
Project: 37599
Buggy source:
private SyncanoObject createSyncanoObject(Class<? extends SyncanoObject> clazz){
  try {
    Constructor<? extends SyncanoObject> defaultConstructor=clazz.getConstructor();
    return defaultConstructor.newInstance();
  }
 catch (  Exception e) {
    return new Gson().fromJson("String_Node_Str",clazz);
  }
}

Fixed version (ground truth):
private SyncanoObject createSyncanoObject(Class<? extends SyncanoObject> clazz){
  try {
    Constructor<? extends SyncanoObject> defaultConstructor=clazz.getConstructor();
    defaultConstructor.setAccessible(true);
    return defaultConstructor.newInstance();
  }
 catch (  Exception e) {
    Gson gson=new GsonBuilder().setFieldNamingStrategy(new SyncanoFieldNamingStrategy()).create();
    return gson.fromJson("String_Node_Str",clazz);
  }
}
Program: 37600
Project: 37600
Buggy source:
public JsonElement serialize(SyncanoObject localObject,Type type,JsonSerializationContext jsc){
  JsonObject jsonObject=new JsonObject();
  Collection<Field> fields=SyncanoClassHelper.findAllSyncanoFields(localObject.getClass());
  for (  Field field : fields) {
    field.setAccessible(true);
    try {
      String keyName=SyncanoClassHelper.getFieldName(field);
      JsonElement jsonElement=toJsonObject(localObject,field,jsc);
      jsonObject.add(keyName,jsonElement);
    }
 catch (    IllegalAccessException e) {
      e.printStackTrace();
    }
  }
  return jsonObject;
}

Fixed version (ground truth):
public JsonElement serialize(SyncanoObject localObject,Type type,JsonSerializationContext jsc){
  JsonObject jsonObject=new JsonObject();
  Collection<Field> fields=SyncanoClassHelper.findAllSyncanoFields(localObject.getClass());
  for (  Field field : fields) {
    field.setAccessible(true);
    if (shouldSkipField(field))     continue;
    try {
      String keyName=SyncanoClassHelper.getFieldName(field);
      JsonElement jsonElement=toJsonObject(localObject,field,jsc);
      jsonObject.add(keyName,jsonElement);
    }
 catch (    IllegalAccessException e) {
      e.printStackTrace();
    }
  }
  return jsonObject;
}
Program: 37601
Project: 37601
Buggy source:
public static void saveUserToStorage(Syncano syncano,AbstractUser user){
  if (syncano.getAndroidContext() == null || !(PlatformType.get() instanceof PlatformType.AndroidPlatform)) {
    return;
  }
  SharedPreferences prefs=syncano.getAndroidContext().getSharedPreferences(Syncano.class.getSimpleName(),Context.MODE_PRIVATE);
  SharedPreferences.Editor editor=prefs.edit();
  if (user == null) {
    editor.remove(dataKey(syncano));
    editor.remove(typeKey(syncano));
  }
 else {
    GsonParser.GsonParseConfig config=new GsonParser.GsonParseConfig();
    config.readOnlyNotImportant=true;
    Gson gson=GsonParser.createGson(config);
    editor.putString(dataKey(syncano),gson.toJson(user));
    editor.putString(typeKey(syncano),user.getClass().getName());
  }
  editor.apply();
}

Fixed version (ground truth):
public static void saveUserToStorage(Syncano syncano,AbstractUser user){
  if (syncano.getAndroidContext() == null || !(PlatformType.get() instanceof PlatformType.AndroidPlatform)) {
    return;
  }
  SharedPreferences prefs=syncano.getAndroidContext().getSharedPreferences(Syncano.class.getSimpleName(),Context.MODE_PRIVATE);
  SharedPreferences.Editor editor=prefs.edit();
  if (user == null) {
    editor.remove(dataKey(syncano));
    editor.remove(typeKey(syncano));
  }
 else {
    GsonParser.GsonParseConfig config=new GsonParser.GsonParseConfig();
    config.serializeReadOnlyFields=true;
    Gson gson=GsonParser.createGson(config);
    editor.putString(dataKey(syncano),gson.toJson(user));
    editor.putString(typeKey(syncano),user.getClass().getName());
  }
  editor.apply();
}
Program: 37602
Project: 37602
Buggy source:
@Test public void testChangeReferenceToPlainObject(){
  Book book=createPlainBook();
  Author author=createPlainAuthor();
  book.author=author;
  Response authorSave=author.save();
  assertTrue(authorSave.isSuccess());
  Response bookSaveResponse=book.save();
  assertTrue(bookSaveResponse.isSuccess());
  assertNotNull(book.author);
  Author otherAuthor=new Author();
  otherAuthor.name="String_Node_Str";
  book.author=otherAuthor;
  book.fetch();
  assertTrue(book.author.isDirty());
}

Fixed version (ground truth):
@Test public void testChangeReferenceToPlainObject(){
  Book book=createPlainBook();
  Author author=createPlainAuthor();
  book.author=author;
  Response authorSave=author.save();
  assertTrue(authorSave.isSuccess());
  Response bookSaveResponse=book.save();
  assertTrue(bookSaveResponse.isSuccess());
  assertNotNull(book.author);
  Author otherAuthor=new Author();
  otherAuthor.name="String_Node_Str";
  book.author=otherAuthor;
  book.fetch();
  assertTrue(book.author.isDirty());
  assertTrue(book.author != otherAuthor);
}
Program: 37603
Project: 37603
Buggy source:
@Test public void testDataTypes(){
  syncano.deleteSyncanoClass(MultiTypesObject.class).send();
  Response<SyncanoClass> respClass=syncano.createSyncanoClass(MultiTypesObject.class).send();
  assertTrue(respClass.isSuccess());
  MultiTypesObject obj1=generateMultiTypesObject();
  Response<MultiTypesObject> resp1=syncano.createObject(obj1).send();
  assertTrue(resp1.isSuccess());
  assertTrue(obj1.reference.save().isSuccess());
  MultiTypesObject serverObj1=resp1.getData();
  assertNotNull(serverObj1);
  assertEquals(obj1.intVal,serverObj1.intVal);
  assertEquals(obj1.byteVal,serverObj1.byteVal);
  assertEquals(obj1.shortVal,serverObj1.shortVal);
  assertEquals(obj1.date,serverObj1.date);
  assertEquals(obj1.nanosDate,serverObj1.nanosDate);
  assertEquals(obj1.stringVal.length(),serverObj1.stringVal.length());
  assertEquals(obj1.stringVal,serverObj1.stringVal);
  assertEquals(obj1.text.length(),serverObj1.text.length());
  assertEquals(obj1.text,serverObj1.text);
  assertNotNull(obj1.reference.getId());
  assertEquals(obj1.reference.getId(),serverObj1.reference.getId());
  assertEquals(obj1.yesOrNo,serverObj1.yesOrNo);
}

Fixed version (ground truth):
@Test public void testDataTypes(){
  syncano.deleteSyncanoClass(MultiTypesObject.class).send();
  Response<SyncanoClass> respClass=syncano.createSyncanoClass(MultiTypesObject.class).send();
  assertTrue(respClass.isSuccess());
  MultiTypesObject obj1=generateMultiTypesObject();
  MultiTypesObject obj2=generateMultiTypesObject();
  assertTrue(obj2.save().isSuccess());
  obj1.reference=obj2;
  Response<MultiTypesObject> resp1=syncano.createObject(obj1).send();
  assertTrue(resp1.isSuccess());
  assertTrue(obj1.reference.save().isSuccess());
  MultiTypesObject serverObj1=resp1.getData();
  assertNotNull(serverObj1);
  assertEquals(obj1.intVal,serverObj1.intVal);
  assertEquals(obj1.byteVal,serverObj1.byteVal);
  assertEquals(obj1.shortVal,serverObj1.shortVal);
  assertEquals(obj1.date,serverObj1.date);
  assertEquals(obj1.nanosDate,serverObj1.nanosDate);
  assertEquals(obj1.stringVal.length(),serverObj1.stringVal.length());
  assertEquals(obj1.stringVal,serverObj1.stringVal);
  assertEquals(obj1.text.length(),serverObj1.text.length());
  assertEquals(obj1.text,serverObj1.text);
  assertNotNull(obj1.reference.getId());
  assertEquals(obj1.reference.getId(),serverObj1.reference.getId());
  assertEquals(obj1.yesOrNo,serverObj1.yesOrNo);
}
Program: 37604
Project: 37604
Buggy source:
@Test public void testSyncanoGetView(){
  ResponseGetList<Warrior> warriorsFromView=syncano.getViewObjects(Warrior.class,tableName).send();
  assertTrue(warriorsFromView.isSuccess());
  ResponseGetList<Warrior> warriors=syncano.getObjects(Warrior.class).send();
  assertTrue(warriors.isSuccess());
  assertFalse(warriorsFromView.getData().isEmpty());
  Warrior warrior=warriorsFromView.getData().get(0);
  assertNotNull(warrior.inventory);
  assertNotNull(warrior.inventory.getId());
  warrior.fetch();
  assertNotNull(warrior.inventory.getId());
  assertNull(warrior.inventory.armor);
  warrior.inventory.fetch();
  assertNotNull(warrior.inventory.armor);
}

Fixed version (ground truth):
@Test public void testSyncanoGetView(){
  ResponseGetList<Warrior> warriorsFromView=syncano.getViewObjects(Warrior.class,tableName).send();
  assertTrue(warriorsFromView.isSuccess());
  ResponseGetList<Warrior> warriors=syncano.getObjects(Warrior.class).send();
  assertTrue(warriors.isSuccess());
  assertFalse(warriorsFromView.getData().isEmpty());
  Warrior warrior=warriorsFromView.getData().get(0);
  assertNotNull(warrior.inventory);
  assertNotNull(warrior.inventory.getId());
  warrior.fetch();
  assertNotNull(warrior.inventory.getId());
  warrior.inventory.fetch();
  assertNotNull(warrior.inventory.armor);
}
Program: 37605
Project: 37605
Buggy source:
public static void main(String[] args){
  Request r=null;
  final RequestPromise<Collection<Book>> listRequestPromise=r.get(Book.class,List.class);
  listRequestPromise.done(new DoneCallback<Collection<Book>>(){
    @Override public void onDone(    Collection<Book> result){
      List<Book> list=(List<Book>)result;
    }
  }
);
  listRequestPromise.always(new AlwaysCallback<Collection<Book>,Throwable,ResponseContext>(){
    @Override public void onAlways(    ResponseContext context,    Collection<Book> resolved,    Throwable rejected){
    }
  }
);
}

Fixed version (ground truth):
public static void main(String[] args){
  RequestDispatcher r=null;
  final RequestPromise<Collection<Book>> listRequestPromise=r.get(Book.class,List.class);
  listRequestPromise.done(new DoneCallback<Collection<Book>>(){
    @Override public void onDone(    Collection<Book> result){
      List<Book> list=(List<Book>)result;
    }
  }
);
  listRequestPromise.always(new AlwaysCallback<Collection<Book>,Throwable,ResponseContext>(){
    @Override public void onAlways(    ResponseContext context,    Collection<Book> resolved,    Throwable rejected){
    }
  }
);
}
Program: 37611
Project: 37611
Buggy source:
/** 
 * uniq ̿����ĤˤޤȤ�ƥ�����̿����κǸ�˰�ư���롣 uniq ̿��ϡ����Ƥμ��Ԥ����륬����̿��Τ����Ǹ����ˤʤ��Ȥ����ʤ��� hara
 */
void fixUniqOrder(){
  boolean found=false;
  List vars=new ArrayList();
  Iterator<Instruction> it=guard.iterator();
  while (it.hasNext()) {
    Instruction inst=it.next();
    if (inst.getKind() == Instruction.UNIQ) {
      found=true;
      vars.addAll((ArrayList)inst.getArg(0));
      it.remove();
    }
  }
  if (found)   guard.add(new Instruction(Instruction.UNIQ,vars));
}

Fixed version (ground truth):
/** 
 * uniq ̿����ĤˤޤȤ�ƥ�����̿����κǸ�˰�ư���롣 uniq ̿��ϡ����Ƥμ��Ԥ����륬����̿��Τ����Ǹ����ˤʤ��Ȥ����ʤ��� hara newhlink�ʤ�, ����ܥ륢�ȥ���������륬����̿����ɲä������ᡢ �ʲ��Τ褦�ˡ�"���Ƥμ��Ԥ����륬����̿��"�κǸ����Ǥ��ꡢ �ɥ���ܥ륢�ȥ�����̿��ɤ���������������� 2011/01/10 seiji .... [���Ƥμ��Ԥ����륬����̿����] [uniq] <-- �������������� [newhlink�ʤɤΥ���ܥ륢�ȥ�����̿����] ....
 */
void fixUniqOrder(){
  boolean found=false;
  List vars=new ArrayList();
  Iterator<Instruction> it=guard.iterator();
  while (it.hasNext()) {
    Instruction inst=it.next();
    if (inst.getKind() == Instruction.UNIQ) {
      found=true;
      vars.addAll((ArrayList)inst.getArg(0));
      it.remove();
    }
  }
  if (found) {
    boolean guardallocs=false;
    Iterator<Instruction> it2=guard.iterator();
    int i=0;
    while (it2.hasNext()) {
      Instruction inst2=it2.next();
      if (inst2.getKind() == Instruction.NEWHLINK || inst2.getKind() == Instruction.MAKEHLINK) {
        guardallocs=true;
        break;
      }
      i++;
    }
    if (guardallocs)     guard.add(i,new Instruction(Instruction.UNIQ,vars));
 else     guard.add(new Instruction(Instruction.UNIQ,vars));
  }
}
Program: 37612
Project: 37612
Buggy source:
void sameProcessContext(Membrane mem,InstructionList list,HashMap sameNameMap,HashMap linkNameToAtomMap){
  List<Instruction> insts=list.insts;
  String newname=null;
  for (  Atom newatom : mem.atoms) {
    for (int i=0; i < newatom.args.length; i++) {
      newname=newatom.args[i].name;
      if (sameNameMap.containsKey(newname)) {
        String oriname=(String)sameNameMap.get(newname);
        Atom oriatom=(Atom)linkNameToAtomMap.get(oriname);
        for (int j=0; j < oriatom.args.length; j++) {
          if (oriatom.args[j].name.equals(oriname)) {
            insts.add(new Instruction(Instruction.FINDPROCCXT,atomToPath(oriatom),oriatom.args.length,j,atomToPath(newatom),newatom.args.length,i));
          }
        }
      }
    }
  }
  for (  Membrane submem : mem.mems) {
    sameProcessContext(submem,list,sameNameMap,linkNameToAtomMap);
  }
}

Fixed version (ground truth):
void sameProcessContext(Membrane mem,InstructionList list,HashMap sameNameMap,HashMap linkNameToAtomMap){
  List<Instruction> insts=list.insts;
  String newname=null;
  for (  Atom newatom : mem.atoms) {
    for (int i=0; i < newatom.args.length; i++) {
      newname=newatom.args[i].name;
      if (sameNameMap.containsKey(newname)) {
        String oriname=(String)sameNameMap.get(newname);
        Atom oriatom=(Atom)linkNameToAtomMap.get(oriname);
        for (int j=0; j < oriatom.args.length; j++) {
          if (oriatom.args[j].name.equals(oriname)) {
            if (atomToPath(oriatom) <= atomToPath(newatom))             insts.add(new Instruction(Instruction.FINDPROCCXT,atomToPath(oriatom),oriatom.args.length,j,atomToPath(newatom),newatom.args.length,i));
 else             insts.add(new Instruction(Instruction.FINDPROCCXT,atomToPath(newatom),newatom.args.length,i,atomToPath(oriatom),oriatom.args.length,j));
          }
        }
      }
    }
  }
  for (  Membrane submem : mem.mems) {
    sameProcessContext(submem,list,sameNameMap,linkNameToAtomMap);
  }
}
Program: 37616
Project: 37616
Buggy source:
void addAll(FunctorAndArgument faa,Set<FunctorAndArgument> set){
  if (!faa.functor.isSymbol())   return;
  if (faa.functor.getName().equals("String_Node_Str"))   return;
  map.addAll(faa,set);
}

Fixed version (ground truth):
void addAll(FunctorAndArgument faa,Set<FunctorAndArgument> set){
  if (!faa.functor.isSymbol())   return;
  if (faa.functor.getName().equals("String_Node_Str"))   return;
  if (set == null) {
    set=new HashSet<FunctorAndArgument>();
  }
  map.addAll(faa,set);
}
Program: 37619
Project: 37619
Buggy source:
public void infer() throws TypeException {
  TypeEnv.initialize(root);
  boolean typeDefined=false;
  Membrane typedefmem=null;
  for (  Membrane topmem : root.mems)   if (topmem.name.equals("String_Node_Str")) {
    typedefmem=topmem;
    break;
  }
  TypeChecker tc=new TypeChecker();
  if (typedefmem != null) {
    typeDefined=tc.parseTypeDefinition(typedefmem);
    root.mems.remove(typedefmem);
  }
  QuantityInferer qi=new QuantityInferer(root);
  if (Env.flgQuantityInference) {
    qi.infer();
  }
  ArgumentInferer ai=new ArgumentInferer(root);
  if (Env.flgArgumentInference) {
    ai.infer();
  }
  if (typeDefined) {
    tc.check(ai,qi);
  }
  if (Env.flgShowConstraints) {
    TypePrinter tp;
    if (Env.flgArgumentInference && Env.flgQuantityInference) {
      tp=new TypePrinter(ai,qi);
      tp.printAll();
    }
  }
}

Fixed version (ground truth):
public void infer() throws TypeException {
  TypeEnv.initialize(root);
  boolean typeDefined=false;
  Membrane typedefmem=null;
  for (  Membrane topmem : root.mems)   if (TypeEnv.getMemName(topmem).equals("String_Node_Str")) {
    typedefmem=topmem;
    break;
  }
  TypeChecker tc=new TypeChecker();
  if (typedefmem != null) {
    typeDefined=tc.parseTypeDefinition(typedefmem);
    root.mems.remove(typedefmem);
  }
  QuantityInferer qi=new QuantityInferer(root);
  if (Env.flgQuantityInference) {
    qi.infer();
  }
  ArgumentInferer ai=new ArgumentInferer(root);
  if (Env.flgArgumentInference) {
    ai.infer();
  }
  if (typeDefined) {
    tc.check(ai,qi);
  }
  if (Env.flgShowConstraints) {
    TypePrinter tp;
    if (Env.flgArgumentInference && Env.flgQuantityInference) {
      tp=new TypePrinter(ai,qi);
      tp.printAll();
    }
  }
}
Program: 37620
Project: 37620
Buggy source:
public void printAll(){
  Env.p("String_Node_Str");
  for (  String memname : sortedMemNames) {
    FixedCounts fcs=memnameToCounts.get(memname);
    Env.p(memname + "String_Node_Str");
    for (    Functor f : sortedFunctors) {
      if (TypeEnv.outOfPassiveFunctor(f) != TypeEnv.ACTIVE)       continue;
      Map<Functor,TypeVarConstraint[]> functorToArgumentTypes=memnameToFunctorTypes.get(memname);
      if (fcs.functorToCount.containsKey(f)) {
        StringBuffer texp=new StringBuffer("String_Node_Str");
        texp.append("String_Node_Str" + f.getQuotedAtomName() + "String_Node_Str");
        TypeVarConstraint[] argtypes=functorToArgumentTypes.get(f);
        for (int i=0; i < argtypes.length; i++) {
          if (i != 0)           texp.append("String_Node_Str");
          texp.append(argtypes[i].shortString());
        }
        texp.append("String_Node_Str");
        FixedCount fc=fcs.functorToCount.get(f);
        texp.append("String_Node_Str" + fc);
        Env.p(texp);
      }
    }
    for (    String childname : sortedMemNames) {
      if (fcs.memnameToCount.containsKey(childname)) {
        FixedCount fc=fcs.memnameToCount.get(childname);
        Env.p("String_Node_Str" + childname + "String_Node_Str"+ fc);
      }
    }
    Env.p("String_Node_Str");
  }
}

Fixed version (ground truth):
public void printAll(){
  Env.p("String_Node_Str");
  for (  String memname : sortedMemNames) {
    FixedCounts fcs=memnameToCounts.get(memname);
    Env.p(memname + "String_Node_Str");
    for (    Functor f : sortedFunctors) {
      if (TypeEnv.outOfPassiveFunctor(f) != TypeEnv.ACTIVE)       continue;
      Map<Functor,TypeVarConstraint[]> functorToArgumentTypes=memnameToFunctorTypes.get(memname);
      if (fcs.functorToCount.containsKey(f)) {
        StringBuffer texp=new StringBuffer("String_Node_Str");
        texp.append("String_Node_Str" + f.getQuotedAtomName());
        if (f.getArity() > 0) {
          texp.append("String_Node_Str");
          TypeVarConstraint[] argtypes=functorToArgumentTypes.get(f);
          for (int i=0; i < argtypes.length; i++) {
            if (i != 0)             texp.append("String_Node_Str");
            texp.append(argtypes[i].shortString());
          }
          texp.append("String_Node_Str");
        }
        FixedCount fc=fcs.functorToCount.get(f);
        texp.append("String_Node_Str" + fc);
        Env.p(texp);
      }
    }
    for (    String childname : sortedMemNames) {
      if (fcs.memnameToCount.containsKey(childname)) {
        FixedCount fc=fcs.memnameToCount.get(childname);
        Env.p("String_Node_Str" + childname + "String_Node_Str"+ fc);
      }
    }
    Env.p("String_Node_Str");
  }
}
Program: 37621
Project: 37621
Buggy source:
public static int renumberLocalsSub(List insts,int locals,int varcount){
  int max=0;
  for (int i=0; i < insts.size(); i++) {
    Instruction inst=(Instruction)insts.get(i);
    if (inst.getKind() == Instruction.NOT) {
      List subinsts=((InstructionList)inst.getArg1()).insts;
      int sub=renumberLocalsSub(subinsts,locals,varcount);
      if (sub > max)       max=sub;
    }
    if (inst.getKind() == Instruction.GUARD_INLINE) {
      ArrayList out=(ArrayList)inst.getArg3();
      for (int j=0; j < out.size(); j++) {
        renumberLocalsSub2(((Integer)out.get(j)).intValue(),locals,varcount,insts,i);
      }
    }
 else {
      if (inst.getOutputType() == -1)       continue;
      if (inst.getIntArg1() != locals) {
        renumberLocalsSub2(inst.getIntArg1(),locals,varcount,insts,i);
      }
    }
    locals++;
  }
  if (locals > max)   max=locals;
  return max;
}

Fixed version (ground truth):
public static int renumberLocalsSub(List insts,int locals,int varcount){
  int max=0;
  for (int i=0; i < insts.size(); i++) {
    Instruction inst=(Instruction)insts.get(i);
    if (inst.getKind() == Instruction.NOT) {
      List subinsts=((InstructionList)inst.getArg1()).insts;
      int sub=renumberLocalsSub(subinsts,locals,varcount);
      if (sub > max)       max=sub;
    }
    if (inst.getKind() == Instruction.GUARD_INLINE) {
      ArrayList out=(ArrayList)inst.getArg3();
      for (int j=0; j < out.size(); j++) {
        renumberLocalsSub2(((Integer)out.get(j)).intValue(),locals,varcount,insts,i);
        if (j < out.size() - 1)         locals++;
      }
    }
 else {
      if (inst.getOutputType() == -1)       continue;
      if (inst.getIntArg1() != locals) {
        renumberLocalsSub2(inst.getIntArg1(),locals,varcount,insts,i);
      }
    }
    locals++;
  }
  if (locals > max)   max=locals;
  return max;
}
Program: 37622
Project: 37622
Buggy source:
protected String quoteFunctorName(String text){
  if (Env.verbose > Env.VERBOSE_SIMPLELINK) {
    if (!text.matches("String_Node_Str")) {
      text=quoteName(text);
    }
  }
 else {
    if (!text.matches("String_Node_Str")) {
      text=quoteName(text);
    }
  }
  return text;
}

Fixed version (ground truth):
private String quoteFunctorName(String text){
  if (Env.verbose > Env.VERBOSE_SIMPLELINK) {
    if (!text.matches("String_Node_Str")) {
      text=quoteName(text);
    }
  }
 else {
    if (!text.matches("String_Node_Str")) {
      text=quoteName(text);
    }
  }
  if (getPath() != null)   text=getPath() + "String_Node_Str" + text;
  return text;
}
Program: 37623
Project: 37623
Buggy source:
protected String quoteAtomName(String text){
  if (!text.matches("String_Node_Str")) {
    if (!text.matches("String_Node_Str")) {
      text=quoteName(text);
    }
  }
  return text;
}

Fixed version (ground truth):
private String quoteAtomName(String text){
  if (!text.matches("String_Node_Str")) {
    if (!text.matches("String_Node_Str")) {
      text=quoteName(text);
    }
  }
  if (getPath() != null)   text=getPath() + "String_Node_Str" + text;
  return text;
}
Program: 37624
Project: 37624
Buggy source:
/** 
 * fqdn���LMNtalDaemon����³���롣
 * @param fqdn �ۥ���̾��Fully Qualified Domain Name�Ǥ������ 
 */
public static boolean makeRemoteConnection(String fqdn){
  Thread t1=new Thread(new MakeRemoteConnectionThread(),"String_Node_Str");
  t1.start();
  if (Env.debugDaemon > 0)   System.out.println("String_Node_Str" + fqdn + "String_Node_Str");
  if (isHostRegistered(fqdn))   return true;
  Socket socket;
  try {
    socket=new Socket(fqdn,Env.daemonListenPort);
    LMNtalDaemonMessageProcessor node=new LMNtalDaemonMessageProcessor(socket);
    if (registerRemoteHostNode(node)) {
      Thread t=new Thread(node,"String_Node_Str");
      t.start();
      return true;
    }
    node.close();
    return false;
  }
 catch (  Exception e) {
    System.out.println("String_Node_Str" + fqdn + "String_Node_Str");
    System.out.println("String_Node_Str" + Env.daemonListenPort);
    e.printStackTrace();
    return false;
  }
}

Fixed version (ground truth):
/** 
 * fqdn���LMNtalDaemon����³���롣
 * @param fqdn �ۥ���̾��Fully Qualified Domain Name�Ǥ������ 
 */
public static boolean makeRemoteConnection(String fqdn){
  if (Env.debugDaemon > 0)   System.out.println("String_Node_Str" + fqdn + "String_Node_Str");
  if (isHostRegistered(fqdn))   return true;
  Socket socket;
  try {
    socket=new Socket(fqdn,Env.daemonListenPort);
    LMNtalDaemonMessageProcessor node=new LMNtalDaemonMessageProcessor(socket);
    if (registerRemoteHostNode(node)) {
      Thread t=new Thread(node,"String_Node_Str");
      t.start();
      return true;
    }
    node.close();
    return false;
  }
 catch (  Exception e) {
    System.out.println("String_Node_Str" + fqdn + "String_Node_Str");
    System.out.println("String_Node_Str" + Env.daemonListenPort);
    e.printStackTrace();
    return false;
  }
}
Program: 37626
Project: 37626
Buggy source:
/** 
 * 加载全局设定
 * @param settingPath 设定文件路径，相对Classpath
 */
synchronized public static void load(String settingPath){
  URL url=URLUtil.getURL(settingPath);
  if (url == null) {
    log.warn("String_Node_Str",settingPath);
    return;
  }
  Setting setting=new Setting(url,CharsetUtil.charset(DEFAULT_CHARSET),true);
  charset=setting.getStringWithDefault("String_Node_Str",DEFAULT_CHARSET);
  urlParamSeparator=setting.getStringWithDefault("String_Node_Str",DEFAULT_URL_PARAM_SEPERATOR);
  actionPackages=setting.getStringsWithDefault("String_Node_Str",new String[]{"String_Node_Str"});
  actionSuffix=setting.getStringWithDefault("String_Node_Str",DEFAULT_ACTION_SUFFIX);
  isDevMode=setting.getBool("String_Node_Str");
}

Fixed version (ground truth):
/** 
 * 加载全局设定
 * @param settingPath 设定文件路径，相对Classpath
 */
synchronized public static void load(String settingPath){
  URL url=URLUtil.getURL(settingPath);
  if (url == null) {
    log.warn("String_Node_Str",settingPath);
    return;
  }
  Setting setting=new Setting(url,CharsetUtil.charset(DEFAULT_CHARSET),true);
  charset=setting.getStr("String_Node_Str",DEFAULT_CHARSET);
  urlParamSeparator=setting.getStr("String_Node_Str",DEFAULT_URL_PARAM_SEPERATOR);
  actionPackages=setting.getStringsWithDefault("String_Node_Str",new String[]{"String_Node_Str"});
  actionSuffix=setting.getStr("String_Node_Str",DEFAULT_ACTION_SUFFIX);
  isDevMode=setting.getBool("String_Node_Str");
}
Program: 37627
Project: 37627
Buggy source:
/** 
 * 将错误发送到容器
 * @param errorCode 错误代码
 * @param errorContent 错误信息
 */
public static void sendError(int errorCode,String errorContent){
  HttpServletResponse response=Response.getServletResponse();
  try {
    if (HuluSetting.isDevMode) {
      response.sendError(errorCode);
    }
 else {
      response.sendError(errorCode,errorContent);
    }
  }
 catch (  IOException e) {
    log.error("String_Node_Str",e);
  }
}

Fixed version (ground truth):
/** 
 * 将错误发送到容器
 * @param errorCode 错误代码
 * @param errorContent 错误信息
 */
public static void sendError(int errorCode,String errorContent){
  HttpServletResponse response=Response.getServletResponse();
  try {
    if (HuluSetting.isDevMode) {
      response.sendError(errorCode);
    }
 else {
      response.sendError(errorCode,errorContent);
    }
  }
 catch (  IOException e) {
    log.error(e,"String_Node_Str");
  }
}
Program: 37628
Project: 37628
Buggy source:
/** 
 * 加载全局设定
 * @param settingPath 设定文件路径，相对Classpath
 */
synchronized public void load(String settingPath){
  URL url=URLUtil.getURL(settingPath);
  if (url == null) {
    log.info("String_Node_Str",settingPath);
    return;
  }
  Setting setting=new Setting(url,CharsetUtil.charset(HuluSetting.charset),true);
  maxFileSize=setting.getInt("String_Node_Str");
  memoryThreshold=setting.getInt("String_Node_Str");
  tmpUploadPath=setting.getString("String_Node_Str");
  fileExts=setting.getStrings("String_Node_Str");
  isAllowFileExts=setting.getBool("String_Node_Str");
}

Fixed version (ground truth):
/** 
 * 加载全局设定
 * @param settingPath 设定文件路径，相对Classpath
 */
synchronized public void load(String settingPath){
  URL url=URLUtil.getURL(settingPath);
  if (url == null) {
    log.info("String_Node_Str",settingPath);
    return;
  }
  Setting setting=new Setting(url,CharsetUtil.charset(HuluSetting.charset),true);
  maxFileSize=setting.getInt("String_Node_Str");
  memoryThreshold=setting.getInt("String_Node_Str");
  tmpUploadPath=setting.getStr("String_Node_Str");
  fileExts=setting.getStrings("String_Node_Str");
  isAllowFileExts=setting.getBool("String_Node_Str");
}
Program: 37629
Project: 37629
Buggy source:
/** 
 * 处理请求
 * @param req ServletRequest
 * @param res ServletResponse
 * @param target 请求目标（请求路径）
 * @return 是否处理成功
 */
public final boolean handle(HttpServletRequest req,HttpServletResponse res,String target){
  if (HuluSetting.isDevMode) {
    log.debug("String_Node_Str",HttpUtil.getClientIP(req),req.getMethod(),target);
  }
  final ActionMethod actionMethod=actionMapping.getActionMethod(target);
  if (actionMethod == null || actionMethod.isHttpMethodMatch() == false) {
    return false;
  }
  fillReqAndRes(req,res);
  actionMethod.resetInterceptorPosition();
  try {
    actionMethod.invoke();
  }
 catch (  ActionException e) {
    Render.renderError500(e.getCause());
  }
 finally {
    clearReqAndRes();
  }
  return true;
}

Fixed version (ground truth):
/** 
 * 处理请求
 * @param req ServletRequest
 * @param res ServletResponse
 * @param target 请求目标（请求路径）
 * @return 是否处理成功
 */
public final boolean handle(HttpServletRequest req,HttpServletResponse res,String target){
  final String method=req.getMethod();
  if (HuluSetting.isDevMode) {
    log.debug("String_Node_Str",HttpUtil.getClientIP(req),method,target);
  }
  final ActionMethod actionMethod=actionMapping.getActionMethod(target);
  if (actionMethod == null || actionMethod.isHttpMethodMatch(method) == false) {
    return false;
  }
  fillReqAndRes(req,res);
  actionMethod.resetInterceptorPosition();
  try {
    actionMethod.invoke();
  }
 catch (  ActionException e) {
    Render.renderError500(e.getCause());
  }
 finally {
    clearReqAndRes();
  }
  return true;
}
Program: 37630
Project: 37630
Buggy source:
/** 
 * 指定用户请求的HTTP方法是否和定义的方法匹配<br> 用户只有在Route注解中定义方法后才会匹配有效性
 * @return 是否匹配
 */
protected boolean isHttpMethodMatch(){
  if (StrUtil.isNotBlank(httpMethod) && httpMethod.equalsIgnoreCase(Request.getServletRequest().getMethod()) == false) {
    if (HuluSetting.isDevMode) {
      StaticLog.warn("String_Node_Str",requestPath,Request.getServletRequest().getMethod(),httpMethod);
    }
    return false;
  }
  return true;
}

Fixed version (ground truth):
/** 
 * 指定用户请求的HTTP方法是否和定义的方法匹配<br> 用户只有在Route注解中定义方法后才会匹配有效性
 * @param method 客户端使用的Http方法
 * @return 是否匹配
 */
protected boolean isHttpMethodMatch(String method){
  if (StrUtil.isNotBlank(httpMethod) && httpMethod.equalsIgnoreCase(method) == false) {
    if (HuluSetting.isDevMode) {
      StaticLog.warn("String_Node_Str",requestPath,method,httpMethod);
    }
    return false;
  }
  return true;
}
Program: 37631
Project: 37631
Buggy source:
/** 
 * 忽略大小写获得请求header中的信息
 * @param headerKey 头信息的KEY
 * @return header值
 */
public final static String getHeaderIgnoreCase(String headerKey){
  Enumeration<String> headerNames=getServletRequest().getHeaderNames();
  String name=null;
  while (headerNames.hasMoreElements()) {
    name=headerNames.nextElement();
    if (name != null && name.equalsIgnoreCase(headerKey)) {
      return getHeader(headerKey);
    }
  }
  return null;
}

Fixed version (ground truth):
/** 
 * 忽略大小写获得请求header中的信息
 * @param headerKey 头信息的KEY
 * @return header值
 */
public final static String getHeaderIgnoreCase(String headerKey){
  Enumeration<String> headerNames=getServletRequest().getHeaderNames();
  String name=null;
  while (headerNames.hasMoreElements()) {
    name=headerNames.nextElement();
    if (name != null && name.equalsIgnoreCase(headerKey)) {
      return getHeader(name);
    }
  }
  return null;
}
Program: 37632
Project: 37632
Buggy source:
/** 
 * 从Request中获得Bean对象
 * @param clazz Bean类，必须包含默认造方法
 * @param isIgnoreError 是否忽略注入错误
 * @return value Object
 */
public static <T>T getBean(Class<T> clazz,final boolean isIgnoreError){
  final T bean=BeanUtil.requestParamToBean(getServletRequest(),clazz,isIgnoreError);
  final MultipartFormData multipart=getMultipart();
  if (null != multipart) {
    final String beanName=StrUtil.lowerFirst(bean.getClass().getSimpleName());
    BeanUtil.fillBean(bean,new ValueProvider<String>(){
      @Override public Object value(      String key,      Type valueType){
        String value=multipart.getParam(key);
        if (StrUtil.isEmpty(value)) {
          value=multipart.getParam(beanName + StrUtil.DOT + key);
          if (StrUtil.isEmpty(value)) {
            value=null;
          }
        }
        return value;
      }
      @Override public boolean containsKey(      String key){
        return null != multipart.getParam(key);
      }
    }
,CopyOptions.create().setIgnoreError(isIgnoreError));
  }
  return bean;
}

Fixed version (ground truth):
/** 
 * 从Request中获得Bean对象
 * @param clazz Bean类，必须包含默认造方法
 * @param isIgnoreError 是否忽略注入错误
 * @return value Object
 */
public static <T>T getBean(Class<T> clazz,final boolean isIgnoreError){
  final T bean=ServletUtil.toBean(getServletRequest(),clazz,isIgnoreError);
  final MultipartFormData multipart=getMultipart();
  if (null != multipart) {
    final String beanName=StrUtil.lowerFirst(bean.getClass().getSimpleName());
    BeanUtil.fillBean(bean,new ValueProvider<String>(){
      @Override public Object value(      String key,      Type valueType){
        String value=multipart.getParam(key);
        if (StrUtil.isEmpty(value)) {
          value=multipart.getParam(beanName + StrUtil.DOT + key);
          if (StrUtil.isEmpty(value)) {
            value=null;
          }
        }
        return value;
      }
      @Override public boolean containsKey(      String key){
        return null != multipart.getParam(key);
      }
    }
,CopyOptions.create().setIgnoreError(isIgnoreError));
  }
  return bean;
}
Program: 37633
Project: 37633
Buggy source:
/** 
 * 输出404信息
 * @param content 错误消息内容
 */
public static void render404Page(String pageContent){
  Response.setStatus(HttpServletResponse.SC_NOT_FOUND);
  Render.renderHtml(pageContent);
}

Fixed version (ground truth):
/** 
 * 输出404信息
 * @param pageContent 错误消息页面内容
 */
public static void render404Page(String pageContent){
  Response.setStatus(HttpServletResponse.SC_NOT_FOUND);
  Render.renderHtml(pageContent);
}
Program: 37634
Project: 37634
Buggy source:
/** 
 * 执行Action方法<br> 同时会执行过滤器方法<br> 此方法为递归调用，每次递归调用此方法，都会判断执行到了第几个拦截器，从而执行拦截器。<br> 当拦截器数量执行完毕后，执行本体方法
 * @param urlParam URL参数
 * @throws ActionException
 */
public void invoke() throws ActionException {
  Integer position=interceptorPosition.get();
  if (position == null) {
    position=0;
  }
  if (interceptors != null && position < interceptors.length) {
    interceptorPosition.set(position + 1);
    interceptors[position].invoke(this);
  }
 else {
    try {
      this.method.invoke(this.action);
    }
 catch (    InvocationTargetException te) {
      throw new ActionException(te);
    }
catch (    Exception e) {
      throw new ActionException("String_Node_Str",e);
    }
    resetInterceptorPosition();
  }
}

Fixed version (ground truth):
/** 
 * 执行Action方法<br> 同时会执行过滤器方法<br> 此方法为递归调用，每次递归调用此方法，都会判断执行到了第几个拦截器，从而执行拦截器。<br> 当拦截器数量执行完毕后，执行本体方法
 * @param urlParam URL参数
 * @throws ActionException
 */
public void invoke() throws ActionException {
  Integer position=interceptorPosition.get();
  if (position == null) {
    position=0;
  }
  if (interceptors != null && position < interceptors.length) {
    interceptorPosition.set(position + 1);
    interceptors[position].invoke(this);
  }
 else {
    try {
      this.method.invoke(this.action);
    }
 catch (    InvocationTargetException te) {
      throw new ActionException(te.getCause());
    }
catch (    Exception e) {
      throw new ActionException("String_Node_Str",e);
    }
    resetInterceptorPosition();
  }
}
Program: 37635
Project: 37635
Buggy source:
/** 
 * 输出404信息 TODO 404页面内容
 */
public static void render404(){
  render(HttpServletResponse.SC_NOT_FOUND,"String_Node_Str");
}

Fixed version (ground truth):
/** 
 * 输出404信息 TODO 404页面内容
 */
public static void render404(){
  sendError(HttpServletResponse.SC_NOT_FOUND,"String_Node_Str");
}