nus-yam/ex-repair huggingface dataset:
Program: 99464
Project: 99464
Buggy source:
/** 
 * constructor
 * @param usbDevice
 * @param usbDeviceConnection
 * @param usbInterface
 * @param midiEventListener
 * @throws IllegalArgumentException endpoint not found.
 */
public MidiInputDevice(UsbDevice usbDevice,UsbDeviceConnection usbDeviceConnection,UsbInterface usbInterface,UsbEndpoint usbEndpoint,OnMidiInputEventListener midiEventListener) throws IllegalArgumentException {
  this.usbDevice=usbDevice;
  this.usbDeviceConnection=usbDeviceConnection;
  this.usbInterface=usbInterface;
  this.midiEventListener=midiEventListener;
  waiterThread=new WaiterThread();
  inputEndpoint=usbEndpoint;
  if (inputEndpoint == null) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  usbDeviceConnection.claimInterface(usbInterface,true);
  waiterThread.setPriority(8);
  waiterThread.start();
}

Fixed version (ground truth):
/** 
 * constructor
 * @param usbDevice
 * @param usbDeviceConnection
 * @param usbInterface
 * @param midiEventListener
 * @throws IllegalArgumentException endpoint not found.
 */
public MidiInputDevice(UsbDevice usbDevice,UsbDeviceConnection usbDeviceConnection,UsbInterface usbInterface,UsbEndpoint usbEndpoint,OnMidiInputEventListener midiEventListener) throws IllegalArgumentException {
  this.usbDevice=usbDevice;
  this.usbDeviceConnection=usbDeviceConnection;
  this.usbInterface=usbInterface;
  this.midiEventListener=midiEventListener;
  waiterThread=new WaiterThread();
  inputEndpoint=usbEndpoint;
  if (inputEndpoint == null) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  usbDeviceConnection.claimInterface(usbInterface,true);
  waiterThread.setPriority(8);
  waiterThread.setName("String_Node_Str" + usbDevice.getDeviceName() + "String_Node_Str");
  waiterThread.start();
}
Program: 99465
Project: 99465
Buggy source:
/** 
 * constructor
 * @param usbDevice
 * @param usbDeviceConnection
 * @param usbInterface
 * @param usbEndpoint
 */
public MidiOutputDevice(UsbDevice usbDevice,UsbDeviceConnection usbDeviceConnection,UsbInterface usbInterface,UsbEndpoint usbEndpoint){
  this.usbDevice=usbDevice;
  this.usbDeviceConnection=usbDeviceConnection;
  this.usbInterface=usbInterface;
  waiterThread=new WaiterThread();
  outputEndpoint=usbEndpoint;
  if (outputEndpoint == null) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  this.usbDeviceConnection.claimInterface(this.usbInterface,true);
  waiterThread.start();
}

Fixed version (ground truth):
/** 
 * constructor
 * @param usbDevice
 * @param usbDeviceConnection
 * @param usbInterface
 * @param usbEndpoint
 */
public MidiOutputDevice(UsbDevice usbDevice,UsbDeviceConnection usbDeviceConnection,UsbInterface usbInterface,UsbEndpoint usbEndpoint){
  this.usbDevice=usbDevice;
  this.usbDeviceConnection=usbDeviceConnection;
  this.usbInterface=usbInterface;
  waiterThread=new WaiterThread();
  outputEndpoint=usbEndpoint;
  if (outputEndpoint == null) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  this.usbDeviceConnection.claimInterface(this.usbInterface,true);
  waiterThread.setName("String_Node_Str" + usbDevice.getDeviceName() + "String_Node_Str");
  waiterThread.start();
}
Program: 99467
Project: 99467
Buggy source:
/** 
 * constructor
 * @param handler
 */
WaiterThread(){
  stopFlag=false;
  suspendFlag=false;
}

Fixed version (ground truth):
/** 
 * constructor
 */
WaiterThread(){
  stopFlag=false;
  suspendFlag=false;
}
Program: 99468
Project: 99468
Buggy source:
/** 
 * stop to use this device.
 */
public void stop(){
  usbDeviceConnection.releaseInterface(usbInterface);
  resume();
  waiterThread.stopFlag=true;
  waiterThread.interrupt();
  while (waiterThread.isAlive()) {
    try {
      Thread.sleep(100);
    }
 catch (    InterruptedException e) {
    }
  }
}

Fixed version (ground truth):
/** 
 * stop to use this device.
 */
public void stop(){
  usbDeviceConnection.releaseInterface(usbInterface);
  resume();
  waiterThread.stopFlag=true;
  while (waiterThread.isAlive()) {
    try {
      waiterThread.interrupt();
      Thread.sleep(100);
    }
 catch (    InterruptedException e) {
    }
  }
}
Program: 99469
Project: 99469
Buggy source:
@Override public void run(){
  while (true) {
    if (stopFlag) {
      if (usbRequest != null) {
        usbRequest.close();
      }
      return;
    }
    while (true) {
      byte[] writeBuffer=null;
synchronized (queue) {
        writeBuffer=queue.poll();
      }
      if (writeBuffer == null) {
        break;
      }
synchronized (usbDeviceConnection) {
        if (usbRequest == null) {
          usbRequest=new UsbRequest();
          usbRequest.initialize(usbDeviceConnection,outputEndpoint);
        }
        while (usbRequest.queue(ByteBuffer.wrap(writeBuffer),4) == false) {
          try {
            Thread.sleep(1);
          }
 catch (          InterruptedException e) {
          }
        }
        while (usbRequest.equals(usbDeviceConnection.requestWait()) == false) {
          try {
            Thread.sleep(1);
          }
 catch (          InterruptedException e) {
          }
        }
      }
    }
  }
}

Fixed version (ground truth):
@Override public void run(){
  while (true) {
    if (stopFlag) {
      if (usbRequest != null) {
        usbRequest.close();
      }
      return;
    }
    while (true) {
      byte[] writeBuffer=null;
synchronized (queue) {
        writeBuffer=queue.poll();
      }
      if (writeBuffer == null) {
        break;
      }
synchronized (usbDeviceConnection) {
        if (usbRequest == null) {
          usbRequest=new UsbRequest();
          usbRequest.initialize(usbDeviceConnection,outputEndpoint);
        }
        while (usbRequest.queue(ByteBuffer.wrap(writeBuffer),writeBuffer.length) == false) {
          try {
            Thread.sleep(1);
          }
 catch (          InterruptedException e) {
          }
        }
        while (usbRequest.equals(usbDeviceConnection.requestWait()) == false) {
          try {
            Thread.sleep(1);
          }
 catch (          InterruptedException e) {
          }
        }
      }
    }
  }
}
Program: 99470
Project: 99470
Buggy source:
@Override public Object clone(){
  byte[] result=new byte[data.length];
  System.arraycopy(data,0,result,0,result.length);
  return new SysexMessage(result);
}

Fixed version (ground truth):
@Override public Object clone(){
  return new SysexMessage(getData());
}
Program: 99471
Project: 99471
Buggy source:
public byte[] getData(){
  byte[] returnedArray=new byte[data.length - 1];
  System.arraycopy(data,1,returnedArray,0,(data.length - 1));
  return returnedArray;
}

Fixed version (ground truth):
public byte[] getData(){
  byte[] result=new byte[data.length];
  System.arraycopy(data,0,result,0,result.length);
  return result;
}
Program: 99472
Project: 99472
Buggy source:
@Override public void run(){
  while (true) {
    if (stopFlag) {
      if (usbRequest != null) {
        usbRequest.close();
      }
      return;
    }
    while (true) {
      byte[] writeBuffer=null;
synchronized (queue) {
        writeBuffer=queue.poll();
      }
      if (writeBuffer == null) {
        break;
      }
synchronized (usbDeviceConnection) {
        if (usbRequest == null) {
          usbRequest=new UsbRequest();
          usbRequest.initialize(usbDeviceConnection,outputEndpoint);
        }
        while (usbRequest.queue(ByteBuffer.wrap(writeBuffer),4) == false) {
          try {
            Thread.sleep(1);
          }
 catch (          InterruptedException e) {
          }
        }
        while (usbRequest.equals(usbDeviceConnection.requestWait()) == false) {
          try {
            Thread.sleep(1);
          }
 catch (          InterruptedException e) {
          }
        }
      }
    }
  }
}

Fixed version (ground truth):
@Override public void run(){
  while (true) {
    if (stopFlag) {
      if (usbRequest != null) {
        usbRequest.close();
      }
      return;
    }
    while (true) {
      byte[] writeBuffer=null;
synchronized (queue) {
        writeBuffer=queue.poll();
      }
      if (writeBuffer == null) {
        break;
      }
synchronized (usbDeviceConnection) {
        if (usbRequest == null) {
          usbRequest=new UsbRequest();
          usbRequest.initialize(usbDeviceConnection,outputEndpoint);
        }
        while (usbRequest.queue(ByteBuffer.wrap(writeBuffer),writeBuffer.length) == false) {
          try {
            Thread.sleep(1);
          }
 catch (          InterruptedException e) {
          }
        }
        while (usbRequest.equals(usbDeviceConnection.requestWait()) == false) {
          try {
            Thread.sleep(1);
          }
 catch (          InterruptedException e) {
          }
        }
      }
    }
  }
}
Program: 99473
Project: 99473
Buggy source:
@Override public Object clone(){
  byte[] result=new byte[data.length];
  System.arraycopy(data,0,result,0,result.length);
  return new SysexMessage(result);
}

Fixed version (ground truth):
@Override public Object clone(){
  return new SysexMessage(getData());
}
Program: 99474
Project: 99474
Buggy source:
public byte[] getData(){
  byte[] returnedArray=new byte[data.length - 1];
  System.arraycopy(data,1,returnedArray,0,(data.length - 1));
  return returnedArray;
}

Fixed version (ground truth):
public byte[] getData(){
  byte[] result=new byte[data.length];
  System.arraycopy(data,0,result,0,result.length);
  return result;
}
Program: 99475
Project: 99475
Buggy source:
/** 
 * Merge the specified   {@link Sequencer}'s   {@link Track}s into one   {@link Track}
 * @param sequencer
 * @param recordEnable
 * @return merged {@link Sequence}
 * @throws InvalidMidiDataException
 */
public static Track mergeSequenceToTrack(Sequencer sequencer,Map<Track,Set<Integer>> recordEnable) throws InvalidMidiDataException {
  Sequence sourceSequence=sequencer.getSequence();
  Track mergedTrack=new Track();
  Track[] tracks=sourceSequence.getTracks();
  boolean hasSoloTrack=false;
  for (int trackIndex=0; trackIndex < tracks.length; trackIndex++) {
    if (sequencer.getTrackSolo(trackIndex)) {
      hasSoloTrack=true;
    }
  }
  for (int trackIndex=0; trackIndex < tracks.length; trackIndex++) {
    if (sequencer.getTrackMute(trackIndex)) {
      continue;
    }
    if (hasSoloTrack && sequencer.getTrackSolo(trackIndex) == false) {
      continue;
    }
    if (sequencer.isRecording() && (recordEnable.get(tracks[trackIndex]) != null && recordEnable.get(tracks[trackIndex]).size() > 0)) {
      continue;
    }
    mergedTrack.events.addAll(tracks[trackIndex].events);
  }
  sortEvents(mergedTrack);
  return mergedTrack;
}

Fixed version (ground truth):
/** 
 * Merge the specified   {@link Sequencer}'s   {@link Track}s into one   {@link Track}
 * @param sequencer
 * @param recordEnable
 * @return merged {@link Sequence}
 * @throws InvalidMidiDataException
 */
public static Track mergeSequenceToTrack(Sequencer sequencer,Map<Track,Set<Integer>> recordEnable) throws InvalidMidiDataException {
  Sequence sourceSequence=sequencer.getSequence();
  Track mergedTrack=new Track();
  Track[] tracks=sourceSequence.getTracks();
  boolean hasSoloTrack=false;
  for (int trackIndex=0; trackIndex < tracks.length; trackIndex++) {
    if (sequencer.getTrackSolo(trackIndex)) {
      hasSoloTrack=true;
      break;
    }
  }
  for (int trackIndex=0; trackIndex < tracks.length; trackIndex++) {
    if (sequencer.getTrackMute(trackIndex)) {
      continue;
    }
    if (hasSoloTrack && sequencer.getTrackSolo(trackIndex) == false) {
      continue;
    }
    if (sequencer.isRecording() && (recordEnable.get(tracks[trackIndex]) != null && recordEnable.get(tracks[trackIndex]).size() > 0)) {
      continue;
    }
    mergedTrack.events.addAll(tracks[trackIndex].events);
  }
  sortEvents(mergedTrack);
  return mergedTrack;
}
Program: 99477
Project: 99477
Buggy source:
@Override public boolean getTrackSolo(int track){
  return trackMute.get(track);
}

Fixed version (ground truth):
@Override public boolean getTrackSolo(int track){
  return trackSolo.get(track);
}
Program: 99478
Project: 99478
Buggy source:
@Override public void setReceiver(Receiver receiver){
  this.receiver=receiver;
}

Fixed version (ground truth):
@Override public void setReceiver(Receiver receiver){
  this.receiver=receiver;
  if (inputDevice == null) {
    open();
  }
}
Program: 99479
Project: 99479
Buggy source:
/** 
 * constructor
 * @param handler
 */
WaiterThread(Handler handler){
  stopFlag=false;
  this.receiveHandler=handler;
}

Fixed version (ground truth):
/** 
 * constructor
 */
WaiterThread(){
  stopFlag=false;
}
Program: 99481
Project: 99481
Buggy source:
/** 
 * constructor
 * @param usbDevice
 * @param usbDeviceConnection
 * @param usbInterface
 * @param midiEventListener
 * @throws IllegalArgumentException endpoint not found.
 */
public MidiInputDevice(UsbDevice usbDevice,UsbDeviceConnection usbDeviceConnection,UsbInterface usbInterface,UsbEndpoint usbEndpoint,OnMidiInputEventListener midiEventListener) throws IllegalArgumentException {
  this.usbDevice=usbDevice;
  this.usbDeviceConnection=usbDeviceConnection;
  this.usbInterface=usbInterface;
  waiterThread=new WaiterThread(new Handler(new MidiMessageCallback(this,midiEventListener)));
  inputEndpoint=usbEndpoint;
  if (inputEndpoint == null) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  usbDeviceConnection.claimInterface(usbInterface,true);
  waiterThread.start();
}

Fixed version (ground truth):
/** 
 * constructor
 * @param usbDevice
 * @param usbDeviceConnection
 * @param usbInterface
 * @param midiEventListener
 * @throws IllegalArgumentException endpoint not found.
 */
public MidiInputDevice(UsbDevice usbDevice,UsbDeviceConnection usbDeviceConnection,UsbInterface usbInterface,UsbEndpoint usbEndpoint,OnMidiInputEventListener midiEventListener) throws IllegalArgumentException {
  this.usbDevice=usbDevice;
  this.usbDeviceConnection=usbDeviceConnection;
  this.usbInterface=usbInterface;
  this.midiEventListener=midiEventListener;
  waiterThread=new WaiterThread();
  inputEndpoint=usbEndpoint;
  if (inputEndpoint == null) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  usbDeviceConnection.claimInterface(usbInterface,true);
  waiterThread.setPriority(8);
  waiterThread.start();
}
Program: 99482
Project: 99482
Buggy source:
@Override public synchronized void onDeviceDetached(UsbDevice detachedDevice){
  if (midiInputDevices == null || midiOutputDevices == null || deviceConnections == null) {
    return;
  }
  Set<MidiInputDevice> inputDevices=midiInputDevices.get(detachedDevice);
  if (inputDevices != null && inputDevices.size() > 0) {
    for (    MidiInputDevice inputDevice : inputDevices) {
      if (inputDevice != null) {
        inputDevice.stop();
      }
    }
    midiInputDevices.remove(detachedDevice);
  }
  Set<MidiOutputDevice> outputDevices=midiOutputDevices.get(detachedDevice);
  if (outputDevices != null) {
    for (    MidiOutputDevice outputDevice : outputDevices) {
      if (outputDevice != null) {
        outputDevice.stop();
      }
    }
    midiOutputDevices.remove(detachedDevice);
  }
  UsbDeviceConnection deviceConnection=deviceConnections.get(detachedDevice);
  if (deviceConnection != null) {
    deviceConnection.close();
    deviceConnections.remove(detachedDevice);
  }
  Log.d(Constants.TAG,"String_Node_Str" + detachedDevice.getDeviceName() + "String_Node_Str");
  Message message=new Message();
  message.obj=detachedDevice;
  deviceDetachedHandler.sendMessage(message);
}

Fixed version (ground truth):
@Override public synchronized void onDeviceDetached(UsbDevice detachedDevice){
  if (midiInputDevices == null || midiOutputDevices == null || deviceConnections == null) {
    return;
  }
  AsyncTask<UsbDevice,Void,Void> task=new AsyncTask<UsbDevice,Void,Void>(){
    @Override protected Void doInBackground(    UsbDevice... params){
      if (params == null || params.length < 1) {
        return null;
      }
      UsbDevice usbDevice=params[0];
      Set<MidiInputDevice> inputDevices=midiInputDevices.get(usbDevice);
      if (inputDevices != null && inputDevices.size() > 0) {
        for (        MidiInputDevice inputDevice : inputDevices) {
          if (inputDevice != null) {
            inputDevice.stop();
          }
        }
        midiInputDevices.remove(usbDevice);
      }
      Set<MidiOutputDevice> outputDevices=midiOutputDevices.get(usbDevice);
      if (outputDevices != null) {
        for (        MidiOutputDevice outputDevice : outputDevices) {
          if (outputDevice != null) {
            outputDevice.stop();
          }
        }
        midiOutputDevices.remove(usbDevice);
      }
      UsbDeviceConnection deviceConnection=deviceConnections.get(usbDevice);
      if (deviceConnection != null) {
        deviceConnection.close();
        deviceConnections.remove(usbDevice);
      }
      Log.d(Constants.TAG,"String_Node_Str" + usbDevice.getDeviceName() + "String_Node_Str");
      Message message=Message.obtain(deviceDetachedHandler);
      message.obj=usbDevice;
      deviceDetachedHandler.sendMessage(message);
      return null;
    }
  }
;
  task.execute(detachedDevice);
}
Program: 99483
Project: 99483
Buggy source:
/** 
 * Get MIDI output device, if available.
 * @param usbDevice
 * @return {@link Set<MidiOutputDevice>}
 */
public final Set<MidiOutputDevice> getMidiOutputDevices(UsbDevice usbDevice){
  if (deviceConnectionWatcher != null) {
    deviceConnectionWatcher.checkConnectedDevicesImmediately();
  }
  if (midiOutputDevices != null) {
    return Collections.unmodifiableSet(midiOutputDevices.get(usbDevice));
  }
  return Collections.unmodifiableSet(new HashSet<MidiOutputDevice>());
}

Fixed version (ground truth):
/** 
 * Get MIDI output device, if available.
 * @param usbDevice
 * @return {@link Set<MidiOutputDevice>}
 */
public final Set<MidiOutputDevice> getMidiOutputDevices(UsbDevice usbDevice){
  if (deviceConnectionWatcher != null) {
    deviceConnectionWatcher.checkConnectedDevicesImmediately();
  }
  if (midiOutputDevices != null && midiOutputDevices.get(usbDevice) != null) {
    return Collections.unmodifiableSet(midiOutputDevices.get(usbDevice));
  }
  return Collections.unmodifiableSet(new HashSet<MidiOutputDevice>());
}
Program: 99484
Project: 99484
Buggy source:
@Override public synchronized void onDeviceDetached(final UsbDevice detachedDevice){
  if (midiInputDevice != null) {
    midiInputDevice.stop();
    midiInputDevice=null;
  }
  if (midiOutputDevice != null) {
    midiOutputDevice.stop();
    midiOutputDevice=null;
  }
  if (deviceConnection != null) {
    deviceConnection.close();
    deviceConnection=null;
  }
  device=null;
  Log.d(Constants.TAG,"String_Node_Str" + detachedDevice.getDeviceName() + "String_Node_Str");
  Message message=new Message();
  message.obj=detachedDevice;
  deviceDetachedHandler.sendMessage(message);
}

Fixed version (ground truth):
@Override public synchronized void onDeviceDetached(final UsbDevice detachedDevice){
  AsyncTask<UsbDevice,Void,Void> task=new AsyncTask<UsbDevice,Void,Void>(){
    @Override protected Void doInBackground(    UsbDevice... params){
      if (params == null || params.length < 1) {
        return null;
      }
      UsbDevice usbDevice=params[0];
      if (midiInputDevice != null) {
        midiInputDevice.stop();
        midiInputDevice=null;
      }
      if (midiOutputDevice != null) {
        midiOutputDevice.stop();
        midiOutputDevice=null;
      }
      if (deviceConnection != null) {
        deviceConnection.close();
        deviceConnection=null;
      }
      device=null;
      Log.d(Constants.TAG,"String_Node_Str" + usbDevice.getDeviceName() + "String_Node_Str");
      Message message=Message.obtain(deviceDetachedHandler);
      message.obj=usbDevice;
      deviceDetachedHandler.sendMessage(message);
      return null;
    }
  }
;
  task.execute(detachedDevice);
}
Program: 99485
Project: 99485
Buggy source:
/** 
 * stops the watching thread
 */
public void stop(){
  waiterThread.stopFlag=true;
  while (waiterThread.isAlive()) {
    try {
      Thread.sleep(100);
    }
 catch (    InterruptedException e) {
    }
  }
  usbDeviceConnection.releaseInterface(usbInterface);
}

Fixed version (ground truth):
/** 
 * stops the watching thread
 */
public void stop(){
  usbDeviceConnection.releaseInterface(usbInterface);
  waiterThread.stopFlag=true;
  while (waiterThread.isAlive()) {
    try {
      Thread.sleep(100);
    }
 catch (    InterruptedException e) {
    }
  }
}
Program: 99486
Project: 99486
Buggy source:
@Override public void run(){
  while (true) {
    if (stopFlag) {
      return;
    }
    if (inputEndpoint == null) {
      continue;
    }
    int length=usbDeviceConnection.bulkTransfer(inputEndpoint,readBuffer,readBuffer.length,0);
    if (length > 0) {
      byte[] read=new byte[length];
      System.arraycopy(readBuffer,0,read,0,length);
      Log.d(Constants.TAG,"String_Node_Str" + Arrays.toString(read));
      Message message=new Message();
      message.obj=read;
      if (!stopFlag) {
        receiveHandler.sendMessage(message);
      }
    }
  }
}

Fixed version (ground truth):
@Override public void run(){
  while (true) {
    if (stopFlag) {
      return;
    }
    if (inputEndpoint == null) {
      continue;
    }
    int length=usbDeviceConnection.bulkTransfer(inputEndpoint,readBuffer,readBuffer.length,0);
    if (length > 0) {
      byte[] read=new byte[length];
      System.arraycopy(readBuffer,0,read,0,length);
      Log.d(Constants.TAG,"String_Node_Str" + Arrays.toString(read));
      Message message=Message.obtain(receiveHandler);
      message.obj=read;
      if (!stopFlag) {
        receiveHandler.sendMessage(message);
      }
    }
  }
}
Program: 99488
Project: 99488
Buggy source:
/** 
 * Sends MIDI message to output device.
 * @param codeIndexNumber
 * @param cable
 * @param byte1
 * @param byte2
 * @param byte3
 */
private void sendMidiMessage(int codeIndexNumber,int cable,int byte1,int byte2,int byte3){
  byte[] writeBuffer=new byte[4];
  writeBuffer[0]=(byte)(((cable & 0xf) << 4) | (codeIndexNumber & 0xf));
  writeBuffer[1]=(byte)byte1;
  writeBuffer[2]=(byte)byte2;
  writeBuffer[3]=(byte)byte3;
synchronized (deviceConnection) {
    if (usbRequest == null) {
      usbRequest=new UsbRequest();
      usbRequest.initialize(deviceConnection,outputEndpoint);
    }
    while (usbRequest.queue(ByteBuffer.wrap(writeBuffer),4) == false) {
      try {
        Thread.sleep(1);
      }
 catch (      InterruptedException e) {
      }
    }
  }
  Log.d(Constants.TAG,"String_Node_Str" + Arrays.toString(writeBuffer));
}

Fixed version (ground truth):
/** 
 * Sends MIDI message to output device.
 * @param codeIndexNumber
 * @param cable
 * @param byte1
 * @param byte2
 * @param byte3
 */
private void sendMidiMessage(int codeIndexNumber,int cable,int byte1,int byte2,int byte3){
  byte[] writeBuffer=new byte[4];
  writeBuffer[0]=(byte)(((cable & 0xf) << 4) | (codeIndexNumber & 0xf));
  writeBuffer[1]=(byte)byte1;
  writeBuffer[2]=(byte)byte2;
  writeBuffer[3]=(byte)byte3;
synchronized (deviceConnection) {
    if (usbRequest == null) {
      usbRequest=new UsbRequest();
      usbRequest.initialize(deviceConnection,outputEndpoint);
    }
    while (usbRequest.queue(ByteBuffer.wrap(writeBuffer),4) == false) {
      try {
        Thread.sleep(1);
      }
 catch (      InterruptedException e) {
      }
    }
    while (usbRequest.equals(deviceConnection.requestWait()) == false) {
      try {
        Thread.sleep(1);
      }
 catch (      InterruptedException e) {
      }
    }
  }
  Log.d(Constants.TAG,"String_Node_Str" + Arrays.toString(writeBuffer));
}
Program: 99489
Project: 99489
Buggy source:
/** 
 * constructor
 * @param usbDevice
 * @param usbDeviceConnection
 * @param usbInterface
 */
public MidiOutputDevice(UsbDevice usbDevice,UsbDeviceConnection usbDeviceConnection,UsbInterface usbInterface,UsbEndpoint usbEndpoint){
  this.usbDevice=usbDevice;
  this.deviceConnection=usbDeviceConnection;
  this.usbInterface=usbInterface;
  outputEndpoint=usbEndpoint;
  if (outputEndpoint == null) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  Log.i(Constants.TAG,"String_Node_Str" + deviceConnection + "String_Node_Str"+ usbInterface);
  deviceConnection.claimInterface(this.usbInterface,true);
  usbRequest=new UsbRequest();
  usbRequest.initialize(deviceConnection,outputEndpoint);
}

Fixed version (ground truth):
/** 
 * constructor
 * @param usbDevice
 * @param usbDeviceConnection
 * @param usbInterface
 */
public MidiOutputDevice(UsbDevice usbDevice,UsbDeviceConnection usbDeviceConnection,UsbInterface usbInterface,UsbEndpoint usbEndpoint){
  this.usbDevice=usbDevice;
  this.deviceConnection=usbDeviceConnection;
  this.usbInterface=usbInterface;
  outputEndpoint=usbEndpoint;
  if (outputEndpoint == null) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  Log.i(Constants.TAG,"String_Node_Str" + deviceConnection + "String_Node_Str"+ usbInterface);
  deviceConnection.claimInterface(this.usbInterface,true);
}
Program: 99491
Project: 99491
Buggy source:
/** 
 * stop to use this device.
 */
public void stop(){
  deviceConnection.releaseInterface(usbInterface);
}

Fixed version (ground truth):
/** 
 * stop to use this device.
 */
public void stop(){
  if (usbRequest != null) {
    usbRequest.close();
  }
  deviceConnection.releaseInterface(usbInterface);
}
Program: 99492
Project: 99492
Buggy source:
/** 
 * Sends MIDI message to output device.
 * @param codeIndexNumber
 * @param cable
 * @param byte1
 * @param byte2
 * @param byte3
 */
private void sendMidiMessage(int codeIndexNumber,int cable,int byte1,int byte2,int byte3){
  byte[] writeBuffer=new byte[4];
  writeBuffer[0]=(byte)(((cable & 0xf) << 4) | (codeIndexNumber & 0xf));
  writeBuffer[1]=(byte)byte1;
  writeBuffer[2]=(byte)byte2;
  writeBuffer[3]=(byte)byte3;
synchronized (deviceConnection) {
    while (usbRequest.queue(ByteBuffer.wrap(writeBuffer),4) == false) {
      try {
        Thread.sleep(1);
      }
 catch (      InterruptedException e) {
      }
    }
  }
  Log.d(Constants.TAG,"String_Node_Str" + Arrays.toString(writeBuffer));
}

Fixed version (ground truth):
/** 
 * Sends MIDI message to output device.
 * @param codeIndexNumber
 * @param cable
 * @param byte1
 * @param byte2
 * @param byte3
 */
private void sendMidiMessage(int codeIndexNumber,int cable,int byte1,int byte2,int byte3){
  byte[] writeBuffer=new byte[4];
  writeBuffer[0]=(byte)(((cable & 0xf) << 4) | (codeIndexNumber & 0xf));
  writeBuffer[1]=(byte)byte1;
  writeBuffer[2]=(byte)byte2;
  writeBuffer[3]=(byte)byte3;
synchronized (deviceConnection) {
    if (usbRequest == null) {
      usbRequest=new UsbRequest();
      usbRequest.initialize(deviceConnection,outputEndpoint);
    }
    while (usbRequest.queue(ByteBuffer.wrap(writeBuffer),4) == false) {
      try {
        Thread.sleep(1);
      }
 catch (      InterruptedException e) {
      }
    }
  }
  Log.d(Constants.TAG,"String_Node_Str" + Arrays.toString(writeBuffer));
}
Program: 99494
Project: 99494
Buggy source:
/** 
 * Sends MIDI message to output device.
 * @param codeIndexNumber
 * @param cable
 * @param byte1
 * @param byte2
 * @param byte3
 */
private void sendMidiMessage(int codeIndexNumber,int cable,int byte1,int byte2,int byte3){
  byte[] writeBuffer=new byte[4];
  writeBuffer[0]=(byte)(((cable & 0xf) << 4) | (codeIndexNumber & 0xf));
  writeBuffer[1]=(byte)byte1;
  writeBuffer[2]=(byte)byte2;
  writeBuffer[3]=(byte)byte3;
synchronized (deviceConnection) {
    if (usbRequest == null) {
      usbRequest=new UsbRequest();
      usbRequest.initialize(deviceConnection,outputEndpoint);
    }
    while (usbRequest.queue(ByteBuffer.wrap(writeBuffer),4) == false) {
      try {
        Thread.sleep(1);
      }
 catch (      InterruptedException e) {
      }
    }
  }
  Log.d(Constants.TAG,"String_Node_Str" + Arrays.toString(writeBuffer));
}

Fixed version (ground truth):
/** 
 * Sends MIDI message to output device.
 * @param codeIndexNumber
 * @param cable
 * @param byte1
 * @param byte2
 * @param byte3
 */
private void sendMidiMessage(int codeIndexNumber,int cable,int byte1,int byte2,int byte3){
  byte[] writeBuffer=new byte[4];
  writeBuffer[0]=(byte)(((cable & 0xf) << 4) | (codeIndexNumber & 0xf));
  writeBuffer[1]=(byte)byte1;
  writeBuffer[2]=(byte)byte2;
  writeBuffer[3]=(byte)byte3;
synchronized (deviceConnection) {
    if (usbRequest == null) {
      usbRequest=new UsbRequest();
      usbRequest.initialize(deviceConnection,outputEndpoint);
    }
    while (usbRequest.queue(ByteBuffer.wrap(writeBuffer),4) == false) {
      try {
        Thread.sleep(1);
      }
 catch (      InterruptedException e) {
      }
    }
    while (usbRequest.equals(deviceConnection.requestWait()) == false) {
      try {
        Thread.sleep(1);
      }
 catch (      InterruptedException e) {
      }
    }
  }
  Log.d(Constants.TAG,"String_Node_Str" + Arrays.toString(writeBuffer));
}
Program: 99495
Project: 99495
Buggy source:
@Override public void run(){
  while (true) {
    if (stopFlag) {
      return;
    }
    if (inputEndpoint == null) {
      continue;
    }
    int length=usbDeviceConnection.bulkTransfer(inputEndpoint,readBuffer,readBuffer.length,1);
    if (length > 0) {
      byte[] read=new byte[length];
      System.arraycopy(readBuffer,0,read,0,length);
      Log.d(Constants.TAG,"String_Node_Str" + Arrays.toString(read));
      Message message=new Message();
      message.obj=read;
      if (!stopFlag) {
        receiveHandler.sendMessage(message);
      }
    }
  }
}

Fixed version (ground truth):
@Override public void run(){
  while (true) {
    if (stopFlag) {
      return;
    }
    if (inputEndpoint == null) {
      continue;
    }
    int length=usbDeviceConnection.bulkTransfer(inputEndpoint,readBuffer,readBuffer.length,0);
    if (length > 0) {
      byte[] read=new byte[length];
      System.arraycopy(readBuffer,0,read,0,length);
      Log.d(Constants.TAG,"String_Node_Str" + Arrays.toString(read));
      Message message=new Message();
      message.obj=read;
      if (!stopFlag) {
        receiveHandler.sendMessage(message);
      }
    }
  }
}
Program: 99497
Project: 99497
Buggy source:
/** 
 * Sends MIDI message to output device.
 * @param codeIndexNumber
 * @param cable
 * @param byte1
 * @param byte2
 * @param byte3
 */
private void sendMidiMessage(int codeIndexNumber,int cable,int byte1,int byte2,int byte3){
  byte[] writeBuffer=new byte[4];
  writeBuffer[0]=(byte)(((cable & 0xf) << 4) | (codeIndexNumber & 0xf));
  writeBuffer[1]=(byte)byte1;
  writeBuffer[2]=(byte)byte2;
  writeBuffer[3]=(byte)byte3;
synchronized (deviceConnection) {
    if (usbRequest == null) {
      usbRequest=new UsbRequest();
      usbRequest.initialize(deviceConnection,outputEndpoint);
    }
    while (usbRequest.queue(ByteBuffer.wrap(writeBuffer),4) == false) {
      try {
        Thread.sleep(1);
      }
 catch (      InterruptedException e) {
      }
    }
  }
  Log.d(Constants.TAG,"String_Node_Str" + Arrays.toString(writeBuffer));
}

Fixed version (ground truth):
/** 
 * Sends MIDI message to output device.
 * @param codeIndexNumber
 * @param cable
 * @param byte1
 * @param byte2
 * @param byte3
 */
private void sendMidiMessage(int codeIndexNumber,int cable,int byte1,int byte2,int byte3){
  byte[] writeBuffer=new byte[4];
  writeBuffer[0]=(byte)(((cable & 0xf) << 4) | (codeIndexNumber & 0xf));
  writeBuffer[1]=(byte)byte1;
  writeBuffer[2]=(byte)byte2;
  writeBuffer[3]=(byte)byte3;
synchronized (deviceConnection) {
    if (usbRequest == null) {
      usbRequest=new UsbRequest();
      usbRequest.initialize(deviceConnection,outputEndpoint);
    }
    while (usbRequest.queue(ByteBuffer.wrap(writeBuffer),4) == false) {
      try {
        Thread.sleep(1);
      }
 catch (      InterruptedException e) {
      }
    }
    while (usbRequest.equals(deviceConnection.requestWait()) == false) {
      try {
        Thread.sleep(1);
      }
 catch (      InterruptedException e) {
      }
    }
  }
  Log.d(Constants.TAG,"String_Node_Str" + Arrays.toString(writeBuffer));
}
Program: 99499
Project: 99499
Buggy source:
/** 
 * Sends MIDI message to output device.
 * @param codeIndexNumber
 * @param cable
 * @param byte1
 * @param byte2
 * @param byte3
 */
private void sendMidiMessage(int codeIndexNumber,int cable,int byte1,int byte2,int byte3){
  byte[] writeBuffer=new byte[outputEndpoint.getMaxPacketSize()];
  writeBuffer[0]=(byte)(((cable & 0xf) << 4) | (codeIndexNumber & 0xf));
  writeBuffer[1]=(byte)byte1;
  writeBuffer[2]=(byte)byte2;
  writeBuffer[3]=(byte)byte3;
  deviceConnection.bulkTransfer(outputEndpoint,writeBuffer,writeBuffer.length,0);
  Log.d(Constants.TAG,"String_Node_Str" + Arrays.toString(writeBuffer));
}

Fixed version (ground truth):
/** 
 * Sends MIDI message to output device.
 * @param codeIndexNumber
 * @param cable
 * @param byte1
 * @param byte2
 * @param byte3
 */
private void sendMidiMessage(int codeIndexNumber,int cable,int byte1,int byte2,int byte3){
  byte[] writeBuffer=new byte[4];
  writeBuffer[0]=(byte)(((cable & 0xf) << 4) | (codeIndexNumber & 0xf));
  writeBuffer[1]=(byte)byte1;
  writeBuffer[2]=(byte)byte2;
  writeBuffer[3]=(byte)byte3;
  deviceConnection.bulkTransfer(outputEndpoint,writeBuffer,writeBuffer.length,0);
  Log.d(Constants.TAG,"String_Node_Str" + Arrays.toString(writeBuffer));
}
Program: 99500
Project: 99500
Buggy source:
/** 
 * constructor
 * @param usbDevice
 * @param usbDeviceConnection
 * @param usbInterface
 */
public MidiOutputDevice(UsbDevice usbDevice,UsbDeviceConnection usbDeviceConnection,UsbInterface usbInterface,UsbEndpoint usbEndpoint){
  this.usbDevice=usbDevice;
  this.deviceConnection=usbDeviceConnection;
  this.usbInterface=usbInterface;
  outputEndpoint=usbEndpoint;
  if (outputEndpoint == null) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  Log.i(Constants.TAG,"String_Node_Str" + deviceConnection + "String_Node_Str"+ usbInterface);
  deviceConnection.claimInterface(this.usbInterface,true);
  usbRequest=new UsbRequest();
  usbRequest.initialize(deviceConnection,outputEndpoint);
}

Fixed version (ground truth):
/** 
 * constructor
 * @param usbDevice
 * @param usbDeviceConnection
 * @param usbInterface
 */
public MidiOutputDevice(UsbDevice usbDevice,UsbDeviceConnection usbDeviceConnection,UsbInterface usbInterface,UsbEndpoint usbEndpoint){
  this.usbDevice=usbDevice;
  this.deviceConnection=usbDeviceConnection;
  this.usbInterface=usbInterface;
  outputEndpoint=usbEndpoint;
  if (outputEndpoint == null) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  Log.i(Constants.TAG,"String_Node_Str" + deviceConnection + "String_Node_Str"+ usbInterface);
  deviceConnection.claimInterface(this.usbInterface,true);
}
Program: 99502
Project: 99502
Buggy source:
/** 
 * stop to use this device.
 */
public void stop(){
  deviceConnection.releaseInterface(usbInterface);
}

Fixed version (ground truth):
/** 
 * stop to use this device.
 */
public void stop(){
  if (usbRequest != null) {
    usbRequest.close();
  }
  deviceConnection.releaseInterface(usbInterface);
}
Program: 99503
Project: 99503
Buggy source:
/** 
 * Sends MIDI message to output device.
 * @param codeIndexNumber
 * @param cable
 * @param byte1
 * @param byte2
 * @param byte3
 */
private void sendMidiMessage(int codeIndexNumber,int cable,int byte1,int byte2,int byte3){
  byte[] writeBuffer=new byte[4];
  writeBuffer[0]=(byte)(((cable & 0xf) << 4) | (codeIndexNumber & 0xf));
  writeBuffer[1]=(byte)byte1;
  writeBuffer[2]=(byte)byte2;
  writeBuffer[3]=(byte)byte3;
synchronized (deviceConnection) {
    while (usbRequest.queue(ByteBuffer.wrap(writeBuffer),4) == false) {
      try {
        Thread.sleep(1);
      }
 catch (      InterruptedException e) {
      }
    }
  }
  Log.d(Constants.TAG,"String_Node_Str" + Arrays.toString(writeBuffer));
}

Fixed version (ground truth):
/** 
 * Sends MIDI message to output device.
 * @param codeIndexNumber
 * @param cable
 * @param byte1
 * @param byte2
 * @param byte3
 */
private void sendMidiMessage(int codeIndexNumber,int cable,int byte1,int byte2,int byte3){
  byte[] writeBuffer=new byte[4];
  writeBuffer[0]=(byte)(((cable & 0xf) << 4) | (codeIndexNumber & 0xf));
  writeBuffer[1]=(byte)byte1;
  writeBuffer[2]=(byte)byte2;
  writeBuffer[3]=(byte)byte3;
synchronized (deviceConnection) {
    if (usbRequest == null) {
      usbRequest=new UsbRequest();
      usbRequest.initialize(deviceConnection,outputEndpoint);
    }
    while (usbRequest.queue(ByteBuffer.wrap(writeBuffer),4) == false) {
      try {
        Thread.sleep(1);
      }
 catch (      InterruptedException e) {
      }
    }
  }
  Log.d(Constants.TAG,"String_Node_Str" + Arrays.toString(writeBuffer));
}
Program: 99504
Project: 99504
Buggy source:
@Override public void run(){
  while (true) {
    if (stopFlag) {
      return;
    }
    if (inputEndpoint == null) {
      continue;
    }
    int length=usbDeviceConnection.bulkTransfer(inputEndpoint,readBuffer,readBuffer.length,1);
    if (length > 0) {
      byte[] read=new byte[length];
      System.arraycopy(readBuffer,0,read,0,length);
      Log.d(Constants.TAG,"String_Node_Str" + Arrays.toString(read));
      Message message=new Message();
      message.obj=read;
      if (!stopFlag) {
        receiveHandler.sendMessage(message);
      }
    }
  }
}

Fixed version (ground truth):
@Override public void run(){
  while (true) {
    if (stopFlag) {
      return;
    }
    if (inputEndpoint == null) {
      continue;
    }
    int length=usbDeviceConnection.bulkTransfer(inputEndpoint,readBuffer,readBuffer.length,0);
    if (length > 0) {
      byte[] read=new byte[length];
      System.arraycopy(readBuffer,0,read,0,length);
      Log.d(Constants.TAG,"String_Node_Str" + Arrays.toString(read));
      Message message=new Message();
      message.obj=read;
      if (!stopFlag) {
        receiveHandler.sendMessage(message);
      }
    }
  }
}
Program: 99506
Project: 99506
Buggy source:
/** 
 * constructor
 * @param usbDevice
 * @param usbDeviceConnection
 * @param usbInterface
 */
public MidiOutputDevice(UsbDevice usbDevice,UsbDeviceConnection usbDeviceConnection,UsbInterface usbInterface,UsbEndpoint usbEndpoint){
  this.usbDevice=usbDevice;
  this.deviceConnection=usbDeviceConnection;
  this.usbInterface=usbInterface;
  outputEndpoint=usbEndpoint;
  if (outputEndpoint == null) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  Log.i(Constants.TAG,"String_Node_Str" + deviceConnection + "String_Node_Str"+ usbInterface);
  deviceConnection.claimInterface(this.usbInterface,true);
  usbRequest=new UsbRequest();
  usbRequest.initialize(deviceConnection,outputEndpoint);
}

Fixed version (ground truth):
/** 
 * constructor
 * @param usbDevice
 * @param usbDeviceConnection
 * @param usbInterface
 */
public MidiOutputDevice(UsbDevice usbDevice,UsbDeviceConnection usbDeviceConnection,UsbInterface usbInterface,UsbEndpoint usbEndpoint){
  this.usbDevice=usbDevice;
  this.deviceConnection=usbDeviceConnection;
  this.usbInterface=usbInterface;
  outputEndpoint=usbEndpoint;
  if (outputEndpoint == null) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  Log.i(Constants.TAG,"String_Node_Str" + deviceConnection + "String_Node_Str"+ usbInterface);
  deviceConnection.claimInterface(this.usbInterface,true);
}
Program: 99508
Project: 99508
Buggy source:
/** 
 * stop to use this device.
 */
public void stop(){
  deviceConnection.releaseInterface(usbInterface);
}

Fixed version (ground truth):
/** 
 * stop to use this device.
 */
public void stop(){
  if (usbRequest != null) {
    usbRequest.close();
  }
  deviceConnection.releaseInterface(usbInterface);
}
Program: 99509
Project: 99509
Buggy source:
/** 
 * Sends MIDI message to output device.
 * @param codeIndexNumber
 * @param cable
 * @param byte1
 * @param byte2
 * @param byte3
 */
private void sendMidiMessage(int codeIndexNumber,int cable,int byte1,int byte2,int byte3){
  byte[] writeBuffer=new byte[4];
  writeBuffer[0]=(byte)(((cable & 0xf) << 4) | (codeIndexNumber & 0xf));
  writeBuffer[1]=(byte)byte1;
  writeBuffer[2]=(byte)byte2;
  writeBuffer[3]=(byte)byte3;
synchronized (deviceConnection) {
    while (usbRequest.queue(ByteBuffer.wrap(writeBuffer),4) == false) {
      try {
        Thread.sleep(1);
      }
 catch (      InterruptedException e) {
      }
    }
  }
  Log.d(Constants.TAG,"String_Node_Str" + Arrays.toString(writeBuffer));
}

Fixed version (ground truth):
/** 
 * Sends MIDI message to output device.
 * @param codeIndexNumber
 * @param cable
 * @param byte1
 * @param byte2
 * @param byte3
 */
private void sendMidiMessage(int codeIndexNumber,int cable,int byte1,int byte2,int byte3){
  byte[] writeBuffer=new byte[4];
  writeBuffer[0]=(byte)(((cable & 0xf) << 4) | (codeIndexNumber & 0xf));
  writeBuffer[1]=(byte)byte1;
  writeBuffer[2]=(byte)byte2;
  writeBuffer[3]=(byte)byte3;
synchronized (deviceConnection) {
    if (usbRequest == null) {
      usbRequest=new UsbRequest();
      usbRequest.initialize(deviceConnection,outputEndpoint);
    }
    while (usbRequest.queue(ByteBuffer.wrap(writeBuffer),4) == false) {
      try {
        Thread.sleep(1);
      }
 catch (      InterruptedException e) {
      }
    }
  }
  Log.d(Constants.TAG,"String_Node_Str" + Arrays.toString(writeBuffer));
}
Program: 99510
Project: 99510
Buggy source:
@Override public void run(){
  while (true) {
    if (stopFlag) {
      return;
    }
    if (inputEndpoint == null) {
      continue;
    }
    int length=usbDeviceConnection.bulkTransfer(inputEndpoint,readBuffer,readBuffer.length,1);
    if (length > 0) {
      byte[] read=new byte[length];
      System.arraycopy(readBuffer,0,read,0,length);
      Log.d(Constants.TAG,"String_Node_Str" + Arrays.toString(read));
      Message message=new Message();
      message.obj=read;
      if (!stopFlag) {
        receiveHandler.sendMessage(message);
      }
    }
  }
}

Fixed version (ground truth):
@Override public void run(){
  while (true) {
    if (stopFlag) {
      return;
    }
    if (inputEndpoint == null) {
      continue;
    }
    int length=usbDeviceConnection.bulkTransfer(inputEndpoint,readBuffer,readBuffer.length,0);
    if (length > 0) {
      byte[] read=new byte[length];
      System.arraycopy(readBuffer,0,read,0,length);
      Log.d(Constants.TAG,"String_Node_Str" + Arrays.toString(read));
      Message message=new Message();
      message.obj=read;
      if (!stopFlag) {
        receiveHandler.sendMessage(message);
      }
    }
  }
}
Program: 99511
Project: 99511
Buggy source:
@BeforeClass public static void oneTimeSetup(){
  RedmineManager mgr=IntegrationTestHelper.createRedmineManager();
  userManager=mgr.getUserManager();
  try {
    createNonAdminUser();
  }
 catch (  Exception e) {
    throw new RuntimeException(e);
  }
}

Fixed version (ground truth):
@BeforeClass public static void oneTimeSetup(){
  mgr=IntegrationTestHelper.createRedmineManager();
  userManager=mgr.getUserManager();
  try {
    createNonAdminUser();
  }
 catch (  Exception e) {
    throw new RuntimeException(e);
  }
}
Program: 99512
Project: 99512
Buggy source:
@BeforeClass public static void oneTimeSetUp(){
  TestConfig testConfig=new TestConfig();
  logger.info("String_Node_Str" + testConfig.getURI());
  RedmineManager mgr=IntegrationTestHelper.createRedmineManager();
  issueManager=mgr.getIssueManager();
  projectManager=mgr.getProjectManager();
  Project junitTestProject=ProjectFactory.create("String_Node_Str","String_Node_Str" + Calendar.getInstance().getTimeInMillis());
  try {
    Project createdProject=projectManager.createProject(junitTestProject);
    projectKey=createdProject.getIdentifier();
    projectId=createdProject.getId();
  }
 catch (  Exception e) {
    logger.error("String_Node_Str",e);
    Assert.fail("String_Node_Str" + e.getMessage());
  }
}

Fixed version (ground truth):
@BeforeClass public static void oneTimeSetUp(){
  TestConfig testConfig=new TestConfig();
  logger.info("String_Node_Str" + testConfig.getURI());
  mgr=IntegrationTestHelper.createRedmineManager();
  issueManager=mgr.getIssueManager();
  projectManager=mgr.getProjectManager();
  Project junitTestProject=ProjectFactory.create("String_Node_Str","String_Node_Str" + Calendar.getInstance().getTimeInMillis());
  try {
    Project createdProject=projectManager.createProject(junitTestProject);
    projectKey=createdProject.getIdentifier();
    projectId=createdProject.getId();
  }
 catch (  Exception e) {
    logger.error("String_Node_Str",e);
    Assert.fail("String_Node_Str" + e.getMessage());
  }
}
Program: 99514
Project: 99514
Buggy source:
@AfterClass public static void oneTimeTearDown(){
  IntegrationTestHelper.deleteProject(mgr,projectKey);
}

Fixed version (ground truth):
@AfterClass public static void oneTimeTearDown(){
  IntegrationTestHelper.deleteProject(mgr,projectKey);
  IntegrationTestHelper.deleteProject(mgr,projectKey2);
}
Program: 99515
Project: 99515
Buggy source:
@BeforeClass public static void oneTimeSetup(){
  mgr=IntegrationTestHelper.createRedmineManager();
  userManager=mgr.getUserManager();
  issueManager=mgr.getIssueManager();
  projectManager=mgr.getProjectManager();
  projectKey=IntegrationTestHelper.createProject(mgr);
}

Fixed version (ground truth):
@BeforeClass public static void oneTimeSetup(){
  mgr=IntegrationTestHelper.createRedmineManager();
  userManager=mgr.getUserManager();
  issueManager=mgr.getIssueManager();
  projectManager=mgr.getProjectManager();
  projectKey=IntegrationTestHelper.createProject(mgr);
  projectKey2=IntegrationTestHelper.createProject(mgr);
}
Program: 99516
Project: 99516
Buggy source:
public static void writeUser(User user,final JSONWriter writer) throws JSONException {
  JsonOutput.addIfNotNull(writer,"String_Node_Str",user.getId());
  JsonOutput.addIfNotNull(writer,"String_Node_Str",user.getLogin());
  JsonOutput.addIfNotNull(writer,"String_Node_Str",user.getPassword());
  JsonOutput.addIfNotNull(writer,"String_Node_Str",user.getFirstName());
  JsonOutput.addIfNotNull(writer,"String_Node_Str",user.getLastName());
  JsonOutput.addIfNotNull(writer,"String_Node_Str",user.getFullName());
  JsonOutput.addIfNotNull(writer,"String_Node_Str",user.getMail());
  addIfNotNullFull(writer,"String_Node_Str",user.getCreatedOn());
  addIfNotNullFull(writer,"String_Node_Str",user.getLastLoginOn());
  writeCustomFields(writer,user.getCustomFields());
}

Fixed version (ground truth):
public static void writeUser(User user,final JSONWriter writer) throws JSONException {
  JsonOutput.addIfNotNull(writer,"String_Node_Str",user.getId());
  JsonOutput.addIfNotNull(writer,"String_Node_Str",user.getLogin());
  JsonOutput.addIfNotNull(writer,"String_Node_Str",user.getPassword());
  JsonOutput.addIfNotNull(writer,"String_Node_Str",user.getFirstName());
  JsonOutput.addIfNotNull(writer,"String_Node_Str",user.getLastName());
  JsonOutput.addIfNotNull(writer,"String_Node_Str",user.getFullName());
  JsonOutput.addIfNotNull(writer,"String_Node_Str",user.getMail());
  JsonOutput.addIfNotNull(writer,"String_Node_Str",user.getAuthSourceId());
  addIfNotNullFull(writer,"String_Node_Str",user.getCreatedOn());
  addIfNotNullFull(writer,"String_Node_Str",user.getLastLoginOn());
  writeCustomFields(writer,user.getCustomFields());
}