nus-yam/ex-repair huggingface dataset:
Program: 174854
Project: 174854
Buggy source:
/** 
 * copied from : https://www.mkyong.com/java/how-to-convert-file-into-an-array-of-bytes/
 * @return The file as an array of bytes.
 */
public byte[] bytes() throws IOException {
  FileInputStream fileInputStream=null;
  byte[] bytesArray=null;
  try {
    File file=new File(filePath);
    bytesArray=new byte[(int)file.length()];
    fileInputStream=new FileInputStream(file);
    fileInputStream.read(bytesArray);
  }
  finally {
    if (fileInputStream != null) {
      fileInputStream.close();
    }
  }
  return bytesArray;
}

Fixed version (ground truth):
/** 
 * copied from : https://www.mkyong.com/java/how-to-convert-file-into-an-array-of-bytes/
 * @return The file as an array of bytes.
 * @throws IOException on Error.
 */
public byte[] bytes() throws IOException {
  FileInputStream fileInputStream=null;
  byte[] bytesArray=null;
  try {
    File file=new File(filePath);
    bytesArray=new byte[(int)file.length()];
    fileInputStream=new FileInputStream(file);
    fileInputStream.read(bytesArray);
  }
  finally {
    if (fileInputStream != null) {
      fileInputStream.close();
    }
  }
  return bytesArray;
}
Program: 174855
Project: 174855
Buggy source:
/** 
 * @param payload
 */
@Override public void instantiate(BytesFile payload){
  count=new VarUInt32(payload);
  functionAll=new ArrayList<>(count.integerValue());
  for (Integer index=0; index < count.integerValue(); index++) {
    FunctionBody function=new FunctionBody(payload);
    functionAll.add(index,function);
  }
}

Fixed version (ground truth):
/** 
 * @param payload the input BytesFile.
 */
@Override public void instantiate(BytesFile payload){
  count=new VarUInt32(payload);
  functionAll=new ArrayList<>(count.integerValue());
  for (Integer index=0; index < count.integerValue(); index++) {
    FunctionBody function=new FunctionBody(payload);
    functionAll.add(index,function);
  }
}
Program: 174856
Project: 174856
Buggy source:
/** 
 * @param payload
 */
@Override public void instantiate(BytesFile payload){
  count=new VarUInt32(payload);
  exports=new WasmVector<>(count.integerValue());
  for (Integer index=0; index < count.integerValue(); index++) {
    ExportEntry export=new ExportEntry(payload);
    exports.add(index,export);
  }
}

Fixed version (ground truth):
/** 
 * @param payload the input BytesFile.
 */
@Override public void instantiate(BytesFile payload){
  count=new VarUInt32(payload);
  exports=new WasmVector<>(count.integerValue());
  for (Integer index=0; index < count.integerValue(); index++) {
    ExportEntry export=new ExportEntry(payload);
    exports.add(index,export);
  }
}
Program: 174857
Project: 174857
Buggy source:
public @NonNull String[] getValue(){
  return value;
}

Fixed version (ground truth):
public @NonNull String getValue(){
  if (!hasValue()) {
    throw new IllegalStateException("String_Node_Str" + key + "String_Node_Str");
  }
  return value[0];
}
Program: 174858
Project: 174858
Buggy source:
protected IniRecord(@NonNull String key,@NonNull String... value){
  this.key=key.trim();
  this.value=value;
  trimValues();
}

Fixed version (ground truth):
protected IniRecord(@NonNull String key,@NonNull String... value){
  this.key=key.trim();
  setValue(value);
}
Program: 174859
Project: 174859
Buggy source:
private void compile(OutputStream outputStream) throws IOException {
  BufferedWriter writer=null;
  try {
    writer=new BufferedWriter(new OutputStreamWriter(outputStream));
    boolean isEmpty=true;
    for (    IniGroup group : groups.values()) {
      if (!isEmpty) {
        writer.newLine();
      }
      writer.write(GROUP_START + group.getName() + GROUP_END);
      isEmpty=false;
      for (      IniRecord record : group.getRecords()) {
        String value=join(ARRAY_VALUE_DELIMITER,record.getValue());
        writer.newLine();
        writer.write(record.getKey() + KEY_VALUE_DIVIDER + value);
      }
    }
    writer.flush();
  }
  finally {
    safeClose(writer);
  }
}

Fixed version (ground truth):
private void compile(OutputStream outputStream) throws IOException {
  BufferedWriter writer=null;
  try {
    writer=new BufferedWriter(new OutputStreamWriter(outputStream));
    boolean isEmpty=true;
    for (    IniGroup group : groups.values()) {
      if (!isEmpty) {
        writer.newLine();
      }
      writer.write(GROUP_START + group.getName() + GROUP_END);
      isEmpty=false;
      for (      IniRecord record : group.getRecords()) {
        String value=join(ARRAY_VALUE_DELIMITER,record.getValues());
        writer.newLine();
        writer.write(record.getKey() + KEY_VALUE_DIVIDER + value);
      }
    }
    writer.flush();
  }
  finally {
    safeClose(writer);
  }
}
Program: 174860
Project: 174860
Buggy source:
public @Nullable String[] getValues(@NonNull String name,@NonNull String key,@Nullable String[] defValue){
  String[] value=defValue;
  IniGroup group=getOrCreateGroup(name);
  IniRecord record=group.getRecord(key);
  if (record != null) {
    value=record.getValue();
  }
  return value;
}

Fixed version (ground truth):
public @Nullable String[] getValues(@NonNull String name,@NonNull String key,@Nullable String[] defValue){
  String[] value=defValue;
  IniGroup group=getOrCreateGroup(name);
  IniRecord record=group.getRecord(key);
  if (record != null) {
    value=record.getValues();
  }
  return value;
}
Program: 174861
Project: 174861
Buggy source:
public @Nullable String getValue(@NonNull String name,@NonNull String key,@Nullable String defValue){
  String value=defValue;
  IniGroup group=getOrCreateGroup(name);
  IniRecord record=group.getRecord(key);
  if (record != null && record.isArrayValue()) {
    value=record.getValue()[0];
  }
  return value;
}

Fixed version (ground truth):
public @Nullable String getValue(@NonNull String name,@NonNull String key,@Nullable String defValue){
  String value=defValue;
  IniGroup group=getOrCreateGroup(name);
  IniRecord record=group.getRecord(key);
  if (record != null && record.hasValue()) {
    value=record.getValue();
  }
  return value;
}
Program: 174862
Project: 174862
Buggy source:
public void saveData(){
  if (status != 0) {
    config.set("String_Node_Str",status);
    config.set("String_Node_Str",top.x + "String_Node_Str" + top.y+ "String_Node_Str"+ top.z+ "String_Node_Str"+ top.level.getFolderName());
    config.set("String_Node_Str",start.x + "String_Node_Str" + start.y+ "String_Node_Str"+ start.z+ "String_Node_Str"+ start.level.getFolderName());
    String l="String_Node_Str";
    for (    Map.Entry<Integer,HashMap<Integer,Position>> entry : line.entrySet()) {
      l+=entry.getKey() + "String_Node_Str";
      for (      Map.Entry<Integer,Position> entry1 : entry.getValue().entrySet()) {
        l+=entry1.getKey() + "String_Node_Str" + entry1.getValue().x+ "String_Node_Str"+ entry1.getValue().y+ "String_Node_Str"+ entry1.getValue().z+ "String_Node_Str"+ entry1.getValue().level.getFolderName()+ "String_Node_Str";
      }
      l=l.substring(0,l.length() - 1);
      l+="String_Node_Str";
    }
    l=l.substring(0,l.length() - 1);
    config.set("String_Node_Str",l);
    config.set("String_Node_Str",first);
    config.save();
  }
}

Fixed version (ground truth):
public void saveData(){
  if (status != 0) {
    config.set("String_Node_Str",status);
    config.set("String_Node_Str",top.x + "String_Node_Str" + top.y+ "String_Node_Str"+ top.z+ "String_Node_Str"+ top.level.getFolderName());
    config.set("String_Node_Str",top2.x + "String_Node_Str" + top2.y+ "String_Node_Str"+ top2.z+ "String_Node_Str"+ top2.level.getFolderName());
    config.set("String_Node_Str",top3.x + "String_Node_Str" + top3.y+ "String_Node_Str"+ top3.z+ "String_Node_Str"+ top3.level.getFolderName());
    config.set("String_Node_Str",start.x + "String_Node_Str" + start.y+ "String_Node_Str"+ start.z+ "String_Node_Str"+ start.level.getFolderName());
    String l="String_Node_Str";
    for (    Map.Entry<Integer,HashMap<Integer,Position>> entry : line.entrySet()) {
      l+=entry.getKey() + "String_Node_Str";
      for (      Map.Entry<Integer,Position> entry1 : entry.getValue().entrySet()) {
        l+=entry1.getKey() + "String_Node_Str" + entry1.getValue().x+ "String_Node_Str"+ entry1.getValue().y+ "String_Node_Str"+ entry1.getValue().z+ "String_Node_Str"+ entry1.getValue().level.getFolderName()+ "String_Node_Str";
      }
      l=l.substring(0,l.length() - 1);
      l+="String_Node_Str";
    }
    l=l.substring(0,l.length() - 1);
    config.set("String_Node_Str",l);
    config.set("String_Node_Str",first);
    config.set("String_Node_Str",second);
    config.set("String_Node_Str",third);
    config.save();
  }
}
Program: 174866
Project: 174866
Buggy source:
public static String getStringContent(IFile file) throws CoreException, IOException {
  BufferedReader r=new BufferedReader(new InputStreamReader(file.getContents(),StandardCharsets.UTF_8));
  String str=null;
  StringBuilder sb=new StringBuilder();
  while ((str=r.readLine()) != null) {
    sb.append(str);
  }
  return sb.toString();
}

Fixed version (ground truth):
public static String getStringContent(IFile file) throws CoreException, IOException {
  BufferedReader r=new BufferedReader(new InputStreamReader(file.getContents(),StandardCharsets.UTF_8));
  String str=null;
  StringBuilder sb=new StringBuilder();
  while ((str=r.readLine()) != null) {
    sb.append(str + '\n');
  }
  return sb.toString();
}
Program: 174867
Project: 174867
Buggy source:
@Override public void run(){
  try {
    if (sApplication != null) {
      return;
    }
    sApplication=getSystemApp();
  }
 catch (  Throwable e) {
    e.printStackTrace();
  }
 finally {
    LOCK.notifyAll();
  }
}

Fixed version (ground truth):
@Override public void run(){
  try {
    if (sApplication != null) {
      return;
    }
    sApplication=getSystemApp();
  }
 catch (  Throwable e) {
    e.printStackTrace();
  }
 finally {
synchronized (LOCK) {
      LOCK.notifyAll();
    }
  }
}
Program: 174868
Project: 174868
Buggy source:
public static void main(String[] args){
  try {
    Gpio led=new Gpio(4);
    Aio lightSensor=new Aio(0);
    led.dir(Dir.DIR_OUT);
    int on=0;
    long lightValue=0;
    String command="String_Node_Str";
    Socket clientSocket=new Socket(args[0],Integer.parseInt(args[1]));
    BufferedReader in=new BufferedReader(new InputStreamReader(clientSocket.getInputStream()));
    PrintWriter out=new PrintWriter(socket.getOutputStream());
    out.println(args[2] + "String_Node_Str" + args[3]);
    System.out.println("String_Node_Str");
    while (true) {
      lightValue=lightSensor.read();
      command=in.readLine().trim().toLowerCase();
      if (command.length() > 0)       System.out.println(command);
      if (command.equals("String_Node_Str")) {
        on=-1;
        led.write(0);
      }
 else       if (command.equals("String_Node_Str")) {
        on=1;
        led.write(1);
      }
 else       if (command.equals("String_Node_Str"))       on=0;
      if (lightValue < 300 && on != -1) {
        led.write(1);
      }
 else       if (on != 1) {
        led.write(0);
      }
      wait1Msec(10);
    }
  }
 catch (  Exception e) {
  }
}

Fixed version (ground truth):
public static void main(String[] args){
  try {
    Gpio led=new Gpio(4);
    Aio lightSensor=new Aio(0);
    led.dir(Dir.DIR_OUT);
    int on=0;
    long lightValue=0;
    String command="String_Node_Str";
    Socket clientSocket=new Socket(args[0],Integer.parseInt(args[1]));
    BufferedReader in=new BufferedReader(new InputStreamReader(clientSocket.getInputStream()));
    PrintWriter out=new PrintWriter(clientSocket.getOutputStream());
    out.println(args[2] + "String_Node_Str" + args[3]);
    System.out.println("String_Node_Str");
    while (true) {
      lightValue=lightSensor.read();
      command=in.readLine().trim().toLowerCase();
      if (command.length() > 0)       System.out.println(command);
      if (command.equals("String_Node_Str")) {
        on=-1;
        led.write(0);
      }
 else       if (command.equals("String_Node_Str")) {
        on=1;
        led.write(1);
      }
 else       if (command.equals("String_Node_Str"))       on=0;
      if (lightValue < 300 && on != -1) {
        led.write(1);
      }
 else       if (on != 1) {
        led.write(0);
      }
      wait1Msec(10);
    }
  }
 catch (  Exception e) {
  }
}
Program: 174869
Project: 174869
Buggy source:
public static void main(String[] args){
  try {
    Gpio led=new Gpio(4);
    Aio lightSensor=new Aio(0);
    led.dir(Dir.DIR_OUT);
    int on=0;
    long lightValue=0;
    String command="String_Node_Str";
    Socket clientSocket=new Socket(args[0],Integer.parseInt(args[1]));
    BufferedReader in=new BufferedReader(new InputStreamReader(clientSocket.getInputStream()));
    System.out.println("String_Node_Str");
    while (true) {
      lightValue=lightSensor.read();
      command=in.readLine().trim().toLowerCase();
      System.out.println(command);
      if (command.equals("String_Node_Str"))       on=1;
 else       if (command.equals("String_Node_Str"))       on=-1;
 else       if (command.equals("String_Node_Str"))       on=0;
      if (lightValue < 200 && on != -1) {
        led.write(1);
      }
 else       if (on != 1) {
        led.write(0);
      }
      wait1Msec(10);
    }
  }
 catch (  Exception e) {
  }
}

Fixed version (ground truth):
public static void main(String[] args){
  try {
    Gpio led=new Gpio(4);
    Aio lightSensor=new Aio(0);
    led.dir(Dir.DIR_OUT);
    int on=0;
    long lightValue=0;
    String command="String_Node_Str";
    Socket clientSocket=new Socket(args[0],Integer.parseInt(args[1]));
    BufferedReader in=new BufferedReader(new InputStreamReader(clientSocket.getInputStream()));
    System.out.println("String_Node_Str");
    while (true) {
      lightValue=lightSensor.read();
      command=in.readLine().trim().toLowerCase();
      if (command.length() > 0)       System.out.println(command);
      if (command.equals("String_Node_Str"))       on=-1;
 else       if (command.equals("String_Node_Str"))       on=1;
 else       if (command.equals("String_Node_Str"))       on=0;
      if (lightValue < 200 && on != -1) {
        led.write(1);
      }
 else       if (on != 1) {
        led.write(0);
      }
      wait1Msec(10);
    }
  }
 catch (  Exception e) {
  }
}
Program: 174870
Project: 174870
Buggy source:
public static void main(String[] args){
  Gpio led=new Gpio(4);
  Aio lightSensor=new Aio(0);
  led.dir(Dir.DIR_OUT);
  int on=0;
  long lightValue=0;
  String command="String_Node_Str";
  Socket clientSocket=new Socket(args[0],Integer.parseInt(args[1]));
  BufferedReader in=new BufferedReader(new InputStreamReader(clientSocket.getInputStream()));
  while (true) {
    lightValue=lightSensor.read();
    command=in.readLine().trim().toLowerCase();
    if (command.equals("String_Node_Str"))     on=1;
 else     if (command.equals("String_Node_Str"))     on=-1;
 else     if (command.equals("String_Node_Str"))     on=0;
    if (lightValue < 200 && on != -1) {
      led.write(1);
    }
 else     if (on != 1) {
      led.write(0);
    }
    wait1Msec(10);
  }
}

Fixed version (ground truth):
public static void main(String[] args){
  Gpio led=new Gpio(4);
  Aio lightSensor=new Aio(0);
  led.dir(Dir.DIR_OUT);
  int on=0;
  long lightValue=0;
  String command="String_Node_Str";
  Socket clientSocket;
  BufferedReader in;
  try {
    clientSocket=new Socket(args[0],Integer.parseInt(args[1]));
    in=new BufferedReader(new InputStreamReader(clientSocket.getInputStream()));
  }
 catch (  Exception e) {
  }
  while (true) {
    lightValue=lightSensor.read();
    try {
      command=in.readLine().trim().toLowerCase();
    }
 catch (    Exception e) {
    }
    if (command.equals("String_Node_Str"))     on=1;
 else     if (command.equals("String_Node_Str"))     on=-1;
 else     if (command.equals("String_Node_Str"))     on=0;
    if (lightValue < 200 && on != -1) {
      led.write(1);
    }
 else     if (on != 1) {
      led.write(0);
    }
    wait1Msec(10);
  }
}
Program: 174871
Project: 174871
Buggy source:
public static void main(String[] args){
  Gpio led=new Gpio(4);
  Aio lightSensor=new Aio(0);
  led.dir(Dir.DIR_OUT);
  int on=0;
  long lightValue=0;
  String command="String_Node_Str";
  Socket clientSocket;
  BufferedReader in;
  try {
    clientSocket=new Socket(args[0],Integer.parseInt(args[1]));
    in=new BufferedReader(new InputStreamReader(clientSocket.getInputStream()));
  }
 catch (  Exception e) {
  }
  while (true) {
    lightValue=lightSensor.read();
    try {
      command=in.readLine().trim().toLowerCase();
    }
 catch (    Exception e) {
    }
    if (command.equals("String_Node_Str"))     on=1;
 else     if (command.equals("String_Node_Str"))     on=-1;
 else     if (command.equals("String_Node_Str"))     on=0;
    if (lightValue < 200 && on != -1) {
      led.write(1);
    }
 else     if (on != 1) {
      led.write(0);
    }
    wait1Msec(10);
  }
}

Fixed version (ground truth):
public static void main(String[] args){
  Gpio led=new Gpio(4);
  Aio lightSensor=new Aio(0);
  led.dir(Dir.DIR_OUT);
  int on=0;
  long lightValue=0;
  String command="String_Node_Str";
  Socket clientSocket;
  BufferedReader in;
  try {
    clientSocket=new Socket(args[0],Integer.parseInt(args[1]));
  }
 catch (  Exception e) {
  }
  try {
    in=new BufferedReader(new InputStreamReader(clientSocket.getInputStream()));
  }
 catch (  Exception e) {
  }
  while (true) {
    lightValue=lightSensor.read();
    try {
      command=in.readLine().trim().toLowerCase();
    }
 catch (    Exception e) {
    }
    if (command.equals("String_Node_Str"))     on=1;
 else     if (command.equals("String_Node_Str"))     on=-1;
 else     if (command.equals("String_Node_Str"))     on=0;
    if (lightValue < 200 && on != -1) {
      led.write(1);
    }
 else     if (on != 1) {
      led.write(0);
    }
    wait1Msec(10);
  }
}
Program: 174872
Project: 174872
Buggy source:
public static void main(String[] args){
  Gpio led=new Gpio(4);
  Aio lightSensor=new Aio(0);
  led.dir(Dir.DIR_OUT);
  int on=0;
  long lightValue=0;
  String command="String_Node_Str";
  Socket clientSocket;
  BufferedReader in;
  try {
    clientSocket=new Socket(args[0],Integer.parseInt(args[1]));
  }
 catch (  Exception e) {
  }
  try {
    in=new BufferedReader(new InputStreamReader(clientSocket.getInputStream()));
  }
 catch (  Exception e) {
  }
  while (true) {
    lightValue=lightSensor.read();
    try {
      command=in.readLine().trim().toLowerCase();
    }
 catch (    Exception e) {
    }
    if (command.equals("String_Node_Str"))     on=1;
 else     if (command.equals("String_Node_Str"))     on=-1;
 else     if (command.equals("String_Node_Str"))     on=0;
    if (lightValue < 200 && on != -1) {
      led.write(1);
    }
 else     if (on != 1) {
      led.write(0);
    }
    wait1Msec(10);
  }
}

Fixed version (ground truth):
public static void main(String[] args){
  Gpio led=new Gpio(4);
  Aio lightSensor=new Aio(0);
  led.dir(Dir.DIR_OUT);
  int on=0;
  long lightValue=0;
  String command="String_Node_Str";
  Socket clientSocket=null;
  BufferedReader in=null;
  try {
    clientSocket=new Socket(args[0],Integer.parseInt(args[1]));
  }
 catch (  Exception e) {
  }
  try {
    in=new BufferedReader(new InputStreamReader(clientSocket.getInputStream()));
  }
 catch (  Exception e) {
  }
  while (true) {
    lightValue=lightSensor.read();
    try {
      command=in.readLine().trim().toLowerCase();
    }
 catch (    Exception e) {
    }
    if (command.equals("String_Node_Str"))     on=1;
 else     if (command.equals("String_Node_Str"))     on=-1;
 else     if (command.equals("String_Node_Str"))     on=0;
    if (lightValue < 200 && on != -1) {
      led.write(1);
    }
 else     if (on != 1) {
      led.write(0);
    }
    wait1Msec(10);
  }
}
Program: 174873
Project: 174873
Buggy source:
public static void main(String[] args){
}

Fixed version (ground truth):
public static void main(String[] args){
  Gpio led=new Gpio(4);
  Aio lightSensor=new Aio(0);
  led.dir(Dir.DIR_OUT);
  int on=0;
  long lightValue=0;
  String command="String_Node_Str";
  Socket clientSocket=new Socket(args[0],Integer.parseInt(args[1]));
  BufferedReader in=new BufferedReader(new InputStreamReader(clientSocket.getInputStream()));
  while (true) {
    lightValue=lightSensor.read();
    command=in.readLine().trim().toLowerCase();
    if (command.equals("String_Node_Str"))     on=1;
 else     if (command.equals("String_Node_Str"))     on=-1;
 else     if (command.equals("String_Node_Str"))     on=0;
    if (lightValue < 200 && on != -1) {
      led.write(1);
    }
 else     if (on != 1) {
      led.write(0);
    }
    wait1Msec(10);
  }
}
Program: 174875
Project: 174875
Buggy source:
Action apply(A a,B b) throws Exception ;

Fixed version (ground truth):
Action apply(A a,B b,C c) throws Exception ;
Program: 174876
Project: 174876
Buggy source:
default <A,B>T subscribeTag(String tag,ControllerMethods.ControllerMethod2<A,B> controllerMethod){
  return subscribeTag(tag,(ControllerMethods.ControllerMethod)controllerMethod);
}

Fixed version (ground truth):
default <A,B,C>T subscribeTag(String tag,ControllerMethods.ControllerMethod3<A,B,C> controllerMethod){
  return subscribeTag(tag,(ControllerMethods.ControllerMethod)controllerMethod);
}
Program: 174877
Project: 174877
Buggy source:
private ArgumentExtractor[] getExtractor(Method method,Class<?>[] parmTypes){
  final Annotation[][] paramAnnotations=method.getParameterAnnotations();
  ArgumentExtractor[] extractors=new ArgumentExtractor[parmTypes.length];
  for (int i=0; i < parmTypes.length; i++) {
    Class cls=parmTypes[i];
    if (Optional.class.isAssignableFrom(cls)) {
      throw new RuntimeException(String.format("String_Node_Str",method));
    }
    extractors[i]=ArgumentExtractors.getArgumentExtractor(cls,paramAnnotations[i],beanFactory);
  }
  return extractors;
}

Fixed version (ground truth):
private ArgumentExtractor[] getExtractor(Method method,Class<?>[] parmTypes){
  final Annotation[][] paramAnnotations=method.getParameterAnnotations();
  ArgumentExtractor[] extractors=new ArgumentExtractor[parmTypes.length];
  for (int i=0; i < parmTypes.length; i++) {
    Class cls=parmTypes[i];
    if (Optional.class.isAssignableFrom(cls)) {
      throw new RuntimeException(String.format("String_Node_Str",method));
    }
    extractors[i]=ArgumentExtractors.getArgumentExtractor(cls,paramAnnotations[i],beanFactory);
  }
  for (int i=0; i < extractors.length; i++) {
    if (extractors[i] == null) {
      extractors[i]=ArgumentExtractors.defaultExtractor;
      break;
    }
  }
  return extractors;
}
Program: 174878
Project: 174878
Buggy source:
public static ArgumentExtractor getArgumentExtractor(Class<?> parameterClass,Annotation[] annotations,DefaultListableBeanFactory beanFactory){
  ArgumentExtractor<?> extractor=STATIC_EXTRACTORS.get(parameterClass);
  if (extractor == null) {
    for (    Annotation annotation : annotations) {
      WithArgumentExtractor withArgumentExtractor=annotation.annotationType().getAnnotation(WithArgumentExtractor.class);
      if (withArgumentExtractor != null) {
        extractor=instantiateComponent(beanFactory,withArgumentExtractor.value(),annotation);
        extractor.init(annotation,parameterClass);
        return extractor;
      }
    }
  }
  if (extractor == null) {
    extractor=defaultExtractor;
  }
  return extractor;
}

Fixed version (ground truth):
public static ArgumentExtractor getArgumentExtractor(Class<?> parameterClass,Annotation[] annotations,DefaultListableBeanFactory beanFactory){
  ArgumentExtractor<?> extractor=STATIC_EXTRACTORS.get(parameterClass);
  if (extractor == null) {
    for (    Annotation annotation : annotations) {
      WithArgumentExtractor withArgumentExtractor=annotation.annotationType().getAnnotation(WithArgumentExtractor.class);
      if (withArgumentExtractor != null) {
        extractor=instantiateComponent(beanFactory,withArgumentExtractor.value(),annotation);
        extractor.init(annotation,parameterClass);
        return extractor;
      }
    }
  }
  return extractor;
}
Program: 174879
Project: 174879
Buggy source:
public void addTag(String tag,Method method){
  if (tagMap.containsKey(tag)) {
    logger.warn(String.format("String_Node_Str",cid,tag));
  }
  Class<?> cls=method.getDeclaringClass();
  final Tag t=new Tag();
  t.setInvokeCls(cls);
  t.setMethodName(method.getName());
  Reconsume mReconsume=method.getAnnotation(Reconsume.class);
  if (null != mReconsume) {
    t.setReconsume(mReconsume.value());
  }
 else {
    Reconsume cReconsume=cls.getAnnotation(Reconsume.class);
    if (null != cReconsume) {
      t.setReconsume(cReconsume.value());
    }
  }
  MethodAccess methodAccess=check.get(cls);
  if (null == methodAccess) {
    methodAccess=MethodAccess.get(cls);
    check.put(cls,methodAccess);
  }
  t.setMethodAccess(methodAccess);
  t.setArgumentExtractors(getExtractor(method,method.getParameterTypes()));
  Stream.of(tag.split("String_Node_Str")).forEach(tag_ -> tagMap.put(tag_.trim(),t));
}

Fixed version (ground truth):
public void addTag(String tag,Method method){
  if (tagMap.containsKey(tag)) {
    logger.warn(String.format("String_Node_Str",cid,tag));
  }
  Class<?> cls=method.getDeclaringClass();
  final Tag t=new Tag();
  t.setInvokeCls(cls);
  t.setMethodName(method.getName());
  Reconsume mReconsume=method.getAnnotation(Reconsume.class);
  if (null != mReconsume) {
    t.setReconsume(mReconsume.value());
  }
 else {
    Reconsume cReconsume=cls.getAnnotation(Reconsume.class);
    if (null != cReconsume) {
      t.setReconsume(cReconsume.value());
    }
  }
  MethodAccess methodAccess=check.get(cls);
  if (null == methodAccess) {
    methodAccess=MethodAccess.get(cls);
    check.put(cls,methodAccess);
  }
  t.setMethodAccess(methodAccess);
  t.setArgumentExtractors(ArgumentExtractors.getArgumentExtractor(method,method.getParameterTypes(),beanFactory));
  Stream.of(tag.split("String_Node_Str")).forEach(tag_ -> tagMap.put(tag_.trim(),t));
}
Program: 174880
Project: 174880
Buggy source:
public static ArgumentExtractor getArgumentExtractor(Class<?> parameterClass,Annotation[] annotations,DefaultListableBeanFactory beanFactory){
  ArgumentExtractor<?> extractor=STATIC_EXTRACTORS.get(parameterClass);
  if (extractor == null) {
    for (    Annotation annotation : annotations) {
      WithArgumentExtractor withArgumentExtractor=annotation.annotationType().getAnnotation(WithArgumentExtractor.class);
      if (withArgumentExtractor != null) {
        extractor=instantiateComponent(beanFactory,withArgumentExtractor.value(),annotation);
        extractor.init(annotation,parameterClass);
        return extractor;
      }
    }
  }
  return extractor;
}

Fixed version (ground truth):
public static ArgumentExtractor[] getArgumentExtractor(Method method,Class<?>[] parmTypes,DefaultListableBeanFactory beanFactory){
  final Annotation[][] paramAnnotations=method.getParameterAnnotations();
  ArgumentExtractor[] extractors=new ArgumentExtractor[parmTypes.length];
  int flag=0;
  for (int i=0; i < parmTypes.length; i++) {
    Class parameterClass=parmTypes[i];
    if (Optional.class.isAssignableFrom(parameterClass)) {
      throw new RuntimeException(String.format("String_Node_Str",method));
    }
    ArgumentExtractor<?> extractor=STATIC_EXTRACTORS.get(parameterClass);
    extractors[i]=extractor;
    if (extractor == null) {
      Annotation[] annotations=paramAnnotations[i];
      for (      Annotation annotation : annotations) {
        WithArgumentExtractor withArgumentExtractor=annotation.annotationType().getAnnotation(WithArgumentExtractor.class);
        if (withArgumentExtractor != null) {
          extractor=instantiateComponent(beanFactory,withArgumentExtractor.value(),annotation);
          extractor.init(annotation,parameterClass);
          flag++;
          break;
        }
      }
    }
    if (extractor == null) {
      extractor=defaultExtractor;
      flag++;
    }
    if (flag == 1) {
      extractors[i]=extractor;
    }
  }
  return extractors;
}
Program: 174883
Project: 174883
Buggy source:
public MatOfDouble getmProjectionCV(){
  if (mProjectionDirtyCV) {
    if (mProjectionCV == null) {
      mProjectionCV=new MatOfDouble();
      mProjectionCV.create(3,3,CvType.CV_64FC1);
    }
    final float fovAspectRatio=mFOVX / mFOVY;
    final double diagonalPx=Math.sqrt((Math.pow(mWidthPx,2.0) + Math.pow(mWidthPx / fovAspectRatio,2.0)));
    final double focalLengthPx=0.5 * diagonalPx / Math.sqrt(Math.pow(Math.tan(0.5 * mFOVX * Math.PI / 180f),2.0) + Math.pow(Math.tan(0.5 * mFOVY * Math.PI / 180f),2.0));
    mProjectionCV.put(0,0,focalLengthPx);
    mProjectionCV.put(0,1,0.0);
    mProjectionCV.put(0,2,0.5 * mWidthPx);
    mProjectionCV.put(1,0,0.0);
    mProjectionCV.put(1,1,focalLengthPx);
    mProjectionCV.put(1,2,0.5 * mHeightPx);
    mProjectionCV.put(2,0,0.0);
    mProjectionCV.put(2,1,0.0);
    mProjectionCV.put(2,2,1.0);
  }
  return mProjectionCV;
}

Fixed version (ground truth):
public MatOfDouble getmProjectionCV(){
  if (mProjectionDirtyCV) {
    if (mProjectionCV == null) {
      mProjectionCV=new MatOfDouble();
      mProjectionCV.create(3,3,CvType.CV_64FC1);
    }
    final float fovAspectRatio=mFOVX / mFOVY;
    final double diagonalPx=Math.sqrt((Math.pow(mWidthPx,2.0) + Math.pow(mWidthPx / fovAspectRatio,2.0)));
    final double diagonalFOV=Math.sqrt((Math.pow(mFOVX,2.0) + Math.pow(mFOVY,2.0)));
    final double focalLengthPx=diagonalPx / (2.0 * Math.tan(0.5 * diagonalFOV * Math.PI / 180f));
    mProjectionCV.put(0,0,focalLengthPx);
    mProjectionCV.put(0,1,0.0);
    mProjectionCV.put(0,2,0.5 * mWidthPx);
    mProjectionCV.put(1,0,0.0);
    mProjectionCV.put(1,1,focalLengthPx);
    mProjectionCV.put(1,2,0.5 * mHeightPx);
    mProjectionCV.put(2,0,0.0);
    mProjectionCV.put(2,1,0.0);
    mProjectionCV.put(2,2,1.0);
  }
  return mProjectionCV;
}
Program: 174885
Project: 174885
Buggy source:
@Override public void onDrawFrame(GL10 gl10){
  gl10.glClear(GL10.GL_COLOR_BUFFER_BIT | GL10.GL_DEPTH_BUFFER_BIT);
  if (filter == null) {
    return;
  }
  if (cameraProjectionAdapter == null) {
    return;
  }
  float[] pose=filter.getGLPose();
  if (pose == null) {
    return;
  }
  final int adjustedWidth=(int)(mSurfaceHeight * cameraProjectionAdapter.getAspectRatio());
  final int marginX=(mSurfaceWidth - adjustedWidth) / 2;
  gl10.glViewport(marginX,0,adjustedWidth,mSurfaceHeight);
  gl10.glMatrixMode(GL10.GL_PROJECTION);
  float[] projection=cameraProjectionAdapter.getProjectionGL();
  gl10.glLoadMatrixf(projection,0);
  gl10.glMatrixMode(GL10.GL_MODELVIEW);
  gl10.glLoadMatrixf(pose,0);
  gl10.glScalef(scale,scale,scale);
  gl10.glTranslatef(0f,0f,0.5f);
  gl10.glEnableClientState(GL10.GL_VERTEX_ARRAY);
  gl10.glEnableClientState(GL10.GL_COLOR_ARRAY);
  gl10.glVertexPointer(3,GL11.GL_FLOAT,0,VERTICES);
  gl10.glColorPointer(4,GL11.GL_UNSIGNED_BYTE,0,COLORS);
  gl10.glEnableClientState(GL10.GL_VERTEX_ARRAY);
  gl10.glEnableClientState(GL10.GL_COLOR_ARRAY);
  gl10.glDrawElements(GL10.GL_TRIANGLES,36,GL10.GL_UNSIGNED_BYTE,TRIANGLES);
  gl10.glDisableClientState(GL10.GL_VERTEX_ARRAY);
  gl10.glDisableClientState(GL10.GL_COLOR_ARRAY);
}

Fixed version (ground truth):
@Override public void onDrawFrame(GL10 gl10){
  gl10.glClear(GL10.GL_COLOR_BUFFER_BIT | GL10.GL_DEPTH_BUFFER_BIT);
  if (filter == null) {
    return;
  }
  if (cameraProjectionAdapter == null) {
    return;
  }
  float[] pose=filter.getGLPose();
  if (pose == null) {
    return;
  }
  final int adjustedWidth=(int)(mSurfaceHeight * cameraProjectionAdapter.getAspectRatio());
  final int marginX=(mSurfaceWidth - adjustedWidth) / 2;
  gl10.glViewport(marginX,0,adjustedWidth,mSurfaceHeight);
  gl10.glMatrixMode(GL10.GL_PROJECTION);
  float[] projection=cameraProjectionAdapter.getProjectionGL();
  gl10.glLoadMatrixf(projection,0);
  gl10.glMatrixMode(GL10.GL_MODELVIEW);
  gl10.glLoadMatrixf(pose,0);
  gl10.glScalef(scale,scale,scale);
  gl10.glTranslatef(0f,0f,0.5f);
  gl10.glVertexPointer(3,GL11.GL_FLOAT,0,VERTICES);
  gl10.glColorPointer(4,GL11.GL_UNSIGNED_BYTE,0,COLORS);
  gl10.glEnableClientState(GL10.GL_VERTEX_ARRAY);
  gl10.glEnableClientState(GL10.GL_COLOR_ARRAY);
  gl10.glDrawElements(GL10.GL_TRIANGLES,36,GL10.GL_UNSIGNED_BYTE,TRIANGLES);
  gl10.glDisableClientState(GL10.GL_VERTEX_ARRAY);
  gl10.glDisableClientState(GL10.GL_COLOR_ARRAY);
}
Program: 174886
Project: 174886
Buggy source:
@Override public void onSurfaceCreated(GL10 gl10,EGLConfig eglConfig){
  gl10.glClearColor(0f,0f,0f,0f);
  gl10.glEnable(GL10.GL_CULL_FACE);
}

Fixed version (ground truth):
@Override public void onSurfaceCreated(final GL10 gl10,final EGLConfig eglConfig){
  gl10.glClearColor(0f,0f,0f,0f);
  gl10.glEnable(GL10.GL_CULL_FACE);
}
Program: 174887
Project: 174887
Buggy source:
public MatOfDouble getmProjectionCV(){
  if (mProjectionDirtyGL) {
    if (mProjectionCV == null) {
      mProjectionCV=new MatOfDouble();
      mProjectionCV.create(3,3,CvType.CV_64FC1);
    }
    final float fovAspectRatio=mFOVX / mFOVY;
    double diagonalPx=Math.sqrt((Math.pow(mWidthPx,2.0) + Math.pow(mWidthPx / fovAspectRatio,2.0)));
    double diagonalFOV=Math.sqrt((Math.pow(mFOVX,2.0) + Math.pow(mFOVY,2.0)));
    double focalLengthPx=diagonalPx / (2.0 * Math.tan(0.5 * diagonalFOV * Math.PI / 180f));
    mProjectionCV.put(0,0,focalLengthPx);
    mProjectionCV.put(0,1,0.0);
    mProjectionCV.put(0,2,0.5 * mWidthPx);
    mProjectionCV.put(1,0,0.0);
    mProjectionCV.put(1,1,focalLengthPx);
    mProjectionCV.put(1,2,0.5 * mHeightPx);
    mProjectionCV.put(2,0,0.0);
    mProjectionCV.put(2,1,0.0);
    mProjectionCV.put(2,2,1.0);
  }
  return mProjectionCV;
}

Fixed version (ground truth):
public MatOfDouble getmProjectionCV(){
  if (mProjectionDirtyCV) {
    if (mProjectionCV == null) {
      mProjectionCV=new MatOfDouble();
      mProjectionCV.create(3,3,CvType.CV_64FC1);
    }
    final float fovAspectRatio=mFOVX / mFOVY;
    final double diagonalPx=Math.sqrt((Math.pow(mWidthPx,2.0) + Math.pow(mWidthPx / fovAspectRatio,2.0)));
    final double focalLengthPx=0.5 * diagonalPx / Math.sqrt(Math.pow(Math.tan(0.5 * mFOVX * Math.PI / 180f),2.0) + Math.pow(Math.tan(0.5 * mFOVY * Math.PI / 180f),2.0));
    mProjectionCV.put(0,0,focalLengthPx);
    mProjectionCV.put(0,1,0.0);
    mProjectionCV.put(0,2,0.5 * mWidthPx);
    mProjectionCV.put(1,0,0.0);
    mProjectionCV.put(1,1,focalLengthPx);
    mProjectionCV.put(1,2,0.5 * mHeightPx);
    mProjectionCV.put(2,0,0.0);
    mProjectionCV.put(2,1,0.0);
    mProjectionCV.put(2,2,1.0);
  }
  return mProjectionCV;
}
Program: 174888
Project: 174888
Buggy source:
protected void draw(Mat src,Mat dst){
  Log.d("String_Node_Str","String_Node_Str");
  if (dst != src) {
    src.copyTo(dst);
  }
  if (!mTargetFound) {
    int height=mReferenceImage.height();
    int width=mReferenceImage.width();
    final int maxDimension=Math.min(dst.width(),dst.height()) / 2;
    final double aspectRatio=width / (double)height;
    if (height > width) {
      height=maxDimension;
      width=(int)(height * aspectRatio);
    }
 else {
      width=maxDimension;
      height=(int)(width / aspectRatio);
    }
    final Mat dstROI=dst.submat(0,height,0,width);
    Imgproc.resize(mReferenceImage,dstROI,dstROI.size(),0.0,0.0,Imgproc.INTER_AREA);
    return;
  }
}

Fixed version (ground truth):
protected void draw(Mat src,Mat dst){
  Log.d("String_Node_Str","String_Node_Str");
  if (dst != src) {
    src.copyTo(dst);
  }
  if (!mTargetFound) {
    int height=mReferenceImage.height();
    int width=mReferenceImage.width();
    final int maxDimension=Math.min(dst.width(),dst.height()) / 2;
    final double aspectRatio=width / (double)height;
    if (height > width) {
      height=maxDimension;
      width=(int)(height * aspectRatio);
    }
 else {
      width=maxDimension;
      height=(int)(width / aspectRatio);
    }
    final Mat dstROI=dst.submat(0,height,0,width);
    Imgproc.resize(mReferenceImage,dstROI,dstROI.size(),0.0,0.0,Imgproc.INTER_AREA);
  }
}
Program: 174889
Project: 174889
Buggy source:
@Override public synchronized void record(final Histogram histogram){
  long maxRecordedValue=histogram.getMaxValue();
  if (logger.isTraceEnabled()) {
    logger.trace("String_Node_Str",maxRecordedValue,getMaxValue());
  }
  if (maxRecordedValue > getMaxValue()) {
    logger.warn("String_Node_Str",maxRecordedValue,getMaxValue());
    setConditionStatus(false);
  }
}

Fixed version (ground truth):
@Override public synchronized void record(final Histogram histogram){
  long maxRecordedValue=histogram.getMaxValue();
  if (logger.isTraceEnabled()) {
    logger.trace("String_Node_Str",maxRecordedValue,getMaxValue());
  }
  if (maxRecordedValue > getMaxValue()) {
    logger.warn("String_Node_Str",maxRecordedValue,getMaxValue());
    setEvalFailed();
  }
}
Program: 174890
Project: 174890
Buggy source:
/** 
 * Constructor
 * @param maxValue maximum value allowed
 */
public LatencyEvaluator(double maxValue){
  this.maxValue=maxValue;
}

Fixed version (ground truth):
/** 
 * Constructor
 * @param maxValue maximum value allowed
 */
protected LatencyEvaluator(double maxValue){
  this.maxValue=maxValue;
}
Program: 174891
Project: 174891
Buggy source:
@Override public synchronized void record(final Histogram histogram){
  long maxRecordedValue=histogram.getValueAtPercentile(this.defaultPercentile);
  if (logger.isTraceEnabled()) {
    logger.trace("String_Node_Str",maxRecordedValue,getMaxValue());
  }
  if (maxRecordedValue > getMaxValue()) {
    logger.warn("String_Node_Str",maxRecordedValue,getMaxValue());
    setConditionStatus(false);
  }
}

Fixed version (ground truth):
@Override public synchronized void record(final Histogram histogram){
  long maxRecordedValue=histogram.getValueAtPercentile(this.defaultPercentile);
  if (logger.isTraceEnabled()) {
    logger.trace("String_Node_Str",maxRecordedValue,getMaxValue());
  }
  if (maxRecordedValue > getMaxValue()) {
    logger.warn("String_Node_Str",maxRecordedValue,getMaxValue());
    setEvalFailed();
  }
}
Program: 174892
Project: 174892
Buggy source:
MessageInfo receiveMessages() throws JMSException {
  TextMessage message=(TextMessage)consumer.receive();
  if (message == null) {
    throw new RuntimeException("String_Node_Str");
  }
  MessageInfo ret=new MessageInfo();
  long ctime=message.getLongProperty("String_Node_Str");
  ret.setCreationTime(Instant.ofEpochMilli(ctime));
  return ret;
}

Fixed version (ground truth):
/** 
 * Returns the epoch millis.
 */
public long receiveMessages() throws JMSException {
  final Message message=consumer.receive();
  if (message == null) {
    throw new RuntimeException("String_Node_Str");
  }
  final long sendTime=message.getLongProperty("String_Node_Str");
  return sendTime;
}
Program: 174893
Project: 174893
Buggy source:
public void start(){
  startedEpochMillis=System.currentTimeMillis();
  logger.info("String_Node_Str");
  try {
    JMSReceiverClient client=new JMSReceiverClient();
    client.setUrl(url);
    workerStateInfo.setState(true,null,null);
    client.start();
    long count=0;
    while (duration.canContinue(this) && isRunning()) {
      final MessageInfo info=client.receiveMessages();
      final long now=System.currentTimeMillis();
      final long creationTime=info.getCreationTime().toEpochMilli();
      final long elapsedMillis=now - creationTime;
      latencyRecorder.recordValue(elapsedMillis);
      workerChannel.emitRate(creationTime,now);
      count++;
      messageCount.lazySet(count);
    }
    logger.info("String_Node_Str");
    workerStateInfo.setState(false,WorkerStateInfo.WorkerExitStatus.WORKER_EXIT_SUCCESS,null);
  }
 catch (  Exception e) {
    logger.error("String_Node_Str",e.getMessage(),e);
    workerStateInfo.setState(false,WorkerStateInfo.WorkerExitStatus.WORKER_EXIT_FAILURE,e);
  }
}

Fixed version (ground truth):
public void start(){
  startedEpochMillis=System.currentTimeMillis();
  logger.info("String_Node_Str");
  try {
    JMSReceiverClient client=new JMSReceiverClient();
    client.setUrl(url);
    workerStateInfo.setState(true,null,null);
    client.start();
    long count=0;
    while (duration.canContinue(this) && isRunning()) {
      final long sendTimeEpochMillis=client.receiveMessages();
      final long now=System.currentTimeMillis();
      final long elapsedMillis=now - sendTimeEpochMillis;
      latencyRecorder.recordValue(elapsedMillis);
      workerChannel.emitRate(sendTimeEpochMillis,now);
      count++;
      messageCount.lazySet(count);
    }
    logger.info("String_Node_Str");
    workerStateInfo.setState(false,WorkerStateInfo.WorkerExitStatus.WORKER_EXIT_SUCCESS,null);
  }
 catch (  Exception e) {
    logger.error("String_Node_Str",e.getMessage(),e);
    workerStateInfo.setState(false,WorkerStateInfo.WorkerExitStatus.WORKER_EXIT_FAILURE,e);
  }
}
Program: 174894
Project: 174894
Buggy source:
void sendMessages() throws JMSException {
  TextMessage message=session.createTextMessage();
  String content=contentStrategy.getContent();
  long stime=System.currentTimeMillis();
  logger.trace("String_Node_Str",stime,content);
  message.setText(content);
  message.setLongProperty("String_Node_Str",stime);
  producer.send(message);
}

Fixed version (ground truth):
public void sendMessages() throws JMSException {
  TextMessage message=session.createTextMessage();
  final String content=contentStrategy.getContent();
  final long now=System.currentTimeMillis();
  message.setText(content);
  message.setLongProperty("String_Node_Str",now);
  producer.send(message);
}
Program: 174895
Project: 174895
Buggy source:
@Test public void testApply_Basic(){
  int numGames=3;
  int numCards=12;
  int maxCard=numCards;
  Strategy strategy=new NextCard();
  List<Player> players=new ArrayList<>();
  Player p1=new Player("String_Node_Str",strategy,maxCard,new Hand());
  Player p2=new Player("String_Node_Str",strategy,maxCard,new Hand());
  Player p3=new Player("String_Node_Str",strategy,maxCard,new Hand());
  players.add(p1);
  players.add(p2);
  players.add(p3);
  List<Player> newPlayers=new Tourney(numCards,numGames,false).apply(players);
  assertEquals(3,newPlayers.size());
  assertEquals(0,newPlayers.get(0).getNumCardsInHand());
  assertEquals(0,newPlayers.get(1).getNumCardsInHand());
  assertEquals(0,newPlayers.get(2).getNumCardsInHand());
  assertEquals(3,newPlayers.stream().map(p -> p.getPlayerStats().getNumGamesWon()).mapToInt(i -> i).sum());
}

Fixed version (ground truth):
@Test public void testApply_Basic(){
  int numGames=3;
  int numCards=12;
  int maxCard=numCards;
  Strategy strategy=Strategies.getNextCardStrategy();
  List<Player> players=new ArrayList<>();
  Player p1=new Player("String_Node_Str",strategy,maxCard,new Hand());
  Player p2=new Player("String_Node_Str",strategy,maxCard,new Hand());
  Player p3=new Player("String_Node_Str",strategy,maxCard,new Hand());
  players.add(p1);
  players.add(p2);
  players.add(p3);
  List<Player> newPlayers=new Tourney(numCards,numGames,false).apply(players);
  assertEquals(3,newPlayers.size());
  assertEquals(0,newPlayers.get(0).getNumCardsInHand());
  assertEquals(0,newPlayers.get(1).getNumCardsInHand());
  assertEquals(0,newPlayers.get(2).getNumCardsInHand());
  assertEquals(3,newPlayers.stream().map(p -> p.getPlayerStats().getNumGamesWon()).mapToInt(i -> i).sum());
}
Program: 174896
Project: 174896
Buggy source:
@Test public void testApply_Basic(){
  int numCards=12;
  int maxCard=numCards;
  Strategy strategy=new NextCard();
  List<Player> players=new ArrayList<>();
  Player p1=new Player("String_Node_Str",strategy,maxCard,new Hand());
  Player p2=new Player("String_Node_Str",strategy,maxCard,new Hand());
  Player p3=new Player("String_Node_Str",strategy,maxCard,new Hand());
  players.add(p1);
  players.add(p2);
  players.add(p3);
  List<Player> newPlayers=new Game(numCards,false).apply(players);
  assertEquals(3,newPlayers.size());
  assertEquals(0,newPlayers.get(0).getNumCardsInHand());
  assertEquals(0,newPlayers.get(1).getNumCardsInHand());
  assertEquals(0,newPlayers.get(2).getNumCardsInHand());
  assertEquals(1,newPlayers.stream().filter(p -> p.getPlayerStats().getNumGamesWon() == 1).count());
  assertEquals(2,newPlayers.stream().filter(p -> p.getPlayerStats().getNumGamesWon() == 0).count());
  int maxTotal=maxCard + (maxCard - 1) + (maxCard - 2);
  assertEquals(3,newPlayers.stream().filter(p -> p.getPlayerStats().getTotal() <= maxTotal).count());
  assertEquals(3,newPlayers.stream().map(p -> p.getPlayerStats().getNumRoundsWon()).mapToInt(i -> i).sum());
}

Fixed version (ground truth):
@Test public void testApply_Basic(){
  int numCards=12;
  int maxCard=numCards;
  List<Player> players=new ArrayList<>();
  Player p1=new Player("String_Node_Str",strategy,maxCard,new Hand());
  Player p2=new Player("String_Node_Str",strategy,maxCard,new Hand());
  Player p3=new Player("String_Node_Str",strategy,maxCard,new Hand());
  players.add(p1);
  players.add(p2);
  players.add(p3);
  List<Player> newPlayers=new Game(numCards,false).apply(players);
  assertEquals(3,newPlayers.size());
  assertEquals(0,newPlayers.get(0).getNumCardsInHand());
  assertEquals(0,newPlayers.get(1).getNumCardsInHand());
  assertEquals(0,newPlayers.get(2).getNumCardsInHand());
  assertEquals(1,newPlayers.stream().filter(p -> p.getPlayerStats().getNumGamesWon() == 1).count());
  assertEquals(2,newPlayers.stream().filter(p -> p.getPlayerStats().getNumGamesWon() == 0).count());
  int maxTotal=maxCard + (maxCard - 1) + (maxCard - 2);
  assertEquals(3,newPlayers.stream().filter(p -> p.getPlayerStats().getTotal() <= maxTotal).count());
  assertEquals(3,newPlayers.stream().map(p -> p.getPlayerStats().getNumRoundsWon()).mapToInt(i -> i).sum());
}
Program: 174897
Project: 174897
Buggy source:
@Test public void testPlay_Basic(){
  int numCards=12;
  int maxCard=numCards;
  Strategy strategy=new NextCard();
  List<Player> players=new ArrayList<>();
  Hand h1=new Hand(Arrays.asList(new Integer[]{1,5,9}));
  Player p1=new Player("String_Node_Str",strategy,maxCard,h1);
  Hand h2=new Hand(Arrays.asList(new Integer[]{4,8,6}));
  Player p2=new Player("String_Node_Str",strategy,maxCard,h2);
  Hand h3=new Hand(Arrays.asList(new Integer[]{7,2,3}));
  Player p3=new Player("String_Node_Str",strategy,maxCard,h3);
  players.add(p1);
  players.add(p2);
  players.add(p3);
  Hand kitty=new Hand(Arrays.asList(new Integer[]{10,11,12}));
  List<Player> newPlayers=new Game(numCards,false).play(kitty,players.stream()).collect(toList());
  assertEquals(3,newPlayers.size());
  assertEquals(0,newPlayers.get(0).getNumCardsInHand());
  assertEquals(0,newPlayers.get(1).getNumCardsInHand());
  assertEquals(0,newPlayers.get(2).getNumCardsInHand());
  assertEquals(3,newPlayers.stream().filter(p -> p.getPlayerStats().getNumRoundsWon() == 1).count());
  assertEquals(1,newPlayers.stream().filter(p -> p.getPlayerStats().getTotal() == 10).count());
  assertEquals(1,newPlayers.stream().filter(p -> p.getPlayerStats().getTotal() == 11).count());
  assertEquals(1,newPlayers.stream().filter(p -> p.getPlayerStats().getTotal() == 12).count());
}

Fixed version (ground truth):
@Test public void testPlay_Basic(){
  int numCards=12;
  int maxCard=numCards;
  List<Player> players=new ArrayList<>();
  Hand h1=new Hand(Arrays.asList(new Integer[]{1,5,9}));
  Player p1=new Player("String_Node_Str",strategy,maxCard,h1);
  Hand h2=new Hand(Arrays.asList(new Integer[]{4,8,6}));
  Player p2=new Player("String_Node_Str",strategy,maxCard,h2);
  Hand h3=new Hand(Arrays.asList(new Integer[]{7,2,3}));
  Player p3=new Player("String_Node_Str",strategy,maxCard,h3);
  players.add(p1);
  players.add(p2);
  players.add(p3);
  Hand kitty=new Hand(Arrays.asList(new Integer[]{10,11,12}));
  List<Player> newPlayers=new Game(numCards,false).play(kitty,players.stream()).collect(toList());
  assertEquals(3,newPlayers.size());
  assertEquals(0,newPlayers.get(0).getNumCardsInHand());
  assertEquals(0,newPlayers.get(1).getNumCardsInHand());
  assertEquals(0,newPlayers.get(2).getNumCardsInHand());
  assertEquals(3,newPlayers.stream().filter(p -> p.getPlayerStats().getNumRoundsWon() == 1).count());
  assertEquals(1,newPlayers.stream().filter(p -> p.getPlayerStats().getTotal() == 10).count());
  assertEquals(1,newPlayers.stream().filter(p -> p.getPlayerStats().getTotal() == 11).count());
  assertEquals(1,newPlayers.stream().filter(p -> p.getPlayerStats().getTotal() == 12).count());
}