nus-yam/ex-repair huggingface dataset:
Program: 11373
Project: 11373
Buggy source:
/** 
 * Disconnects the device by its address
 * @param deviceAddress the device address from {@link android.bluetooth.BluetoothGatt}
 */
private void disconnectByDeviceAddress(@NonNull String deviceAddress){
synchronized (deviceAddressGattMap) {
    BluetoothGatt bluetoothGatt=deviceAddressGattMap.get(deviceAddress);
    if (bluetoothGatt != null) {
      bluetoothGatt.disconnect();
      bluetoothGatt.close();
      deviceAddressGattMap.remove(deviceAddress);
    }
  }
synchronized (midiInputDevicesMap) {
    Set<MidiInputDevice> midiInputDevices=midiInputDevicesMap.get(deviceAddress);
    if (midiInputDevices != null) {
      midiInputDevicesMap.remove(deviceAddress);
      for (      MidiInputDevice midiInputDevice : midiInputDevices) {
        midiInputDevice.setOnMidiInputEventListener(null);
        if (midiDeviceDetachedListener != null) {
          midiDeviceDetachedListener.onMidiInputDeviceDetached(midiInputDevice);
        }
      }
      midiInputDevices.clear();
    }
  }
synchronized (midiOutputDevicesMap) {
    Set<MidiOutputDevice> midiOutputDevices=midiOutputDevicesMap.get(deviceAddress);
    if (midiOutputDevices != null) {
      midiOutputDevicesMap.remove(deviceAddress);
      for (      MidiOutputDevice midiOutputDevice : midiOutputDevices) {
        if (midiDeviceDetachedListener != null) {
          midiDeviceDetachedListener.onMidiOutputDeviceDetached(midiOutputDevice);
        }
      }
      midiOutputDevices.clear();
    }
  }
}

Fixed version (ground truth):
/** 
 * Disconnects the device by its address
 * @param deviceAddress the device address from {@link android.bluetooth.BluetoothGatt}
 */
private void disconnectByDeviceAddress(@NonNull String deviceAddress){
synchronized (deviceAddressGattMap) {
    BluetoothGatt bluetoothGatt=deviceAddressGattMap.get(deviceAddress);
    if (bluetoothGatt != null) {
      bluetoothGatt.disconnect();
      bluetoothGatt.close();
      deviceAddressGattMap.remove(deviceAddress);
    }
  }
synchronized (midiInputDevicesMap) {
    Set<MidiInputDevice> midiInputDevices=midiInputDevicesMap.get(deviceAddress);
    if (midiInputDevices != null) {
      midiInputDevicesMap.remove(deviceAddress);
      for (      MidiInputDevice midiInputDevice : midiInputDevices) {
        ((InternalMidiInputDevice)midiInputDevice).stop();
        midiInputDevice.setOnMidiInputEventListener(null);
        if (midiDeviceDetachedListener != null) {
          midiDeviceDetachedListener.onMidiInputDeviceDetached(midiInputDevice);
        }
      }
      midiInputDevices.clear();
    }
  }
synchronized (midiOutputDevicesMap) {
    Set<MidiOutputDevice> midiOutputDevices=midiOutputDevicesMap.get(deviceAddress);
    if (midiOutputDevices != null) {
      midiOutputDevicesMap.remove(deviceAddress);
      for (      MidiOutputDevice midiOutputDevice : midiOutputDevices) {
        if (midiDeviceDetachedListener != null) {
          midiDeviceDetachedListener.onMidiOutputDeviceDetached(midiOutputDevice);
        }
      }
      midiOutputDevices.clear();
    }
  }
}
Program: 11375
Project: 11375
Buggy source:
/** 
 * Terminates callback
 */
public void terminate(){
synchronized (deviceAddressGattMap) {
    for (    BluetoothGatt bluetoothGatt : deviceAddressGattMap.values()) {
      bluetoothGatt.disconnect();
      bluetoothGatt.close();
    }
    deviceAddressGattMap.clear();
  }
synchronized (midiInputDevicesMap) {
    for (    Set<MidiInputDevice> midiInputDevices : midiInputDevicesMap.values()) {
      for (      MidiInputDevice midiInputDevice : midiInputDevices) {
        midiInputDevice.setOnMidiInputEventListener(null);
      }
      midiInputDevices.clear();
    }
    midiInputDevicesMap.clear();
  }
synchronized (midiOutputDevicesMap) {
    midiOutputDevicesMap.clear();
  }
  if (bondingBroadcastReceiver != null) {
    context.unregisterReceiver(bondingBroadcastReceiver);
    bondingBroadcastReceiver=null;
  }
}

Fixed version (ground truth):
/** 
 * Terminates callback
 */
public void terminate(){
synchronized (deviceAddressGattMap) {
    for (    BluetoothGatt bluetoothGatt : deviceAddressGattMap.values()) {
      bluetoothGatt.disconnect();
      bluetoothGatt.close();
    }
    deviceAddressGattMap.clear();
  }
synchronized (midiInputDevicesMap) {
    for (    Set<MidiInputDevice> midiInputDevices : midiInputDevicesMap.values()) {
      for (      MidiInputDevice midiInputDevice : midiInputDevices) {
        ((InternalMidiInputDevice)midiInputDevice).stop();
        midiInputDevice.setOnMidiInputEventListener(null);
      }
      midiInputDevices.clear();
    }
    midiInputDevicesMap.clear();
  }
synchronized (midiOutputDevicesMap) {
    midiOutputDevicesMap.clear();
  }
  if (bondingBroadcastReceiver != null) {
    context.unregisterReceiver(bondingBroadcastReceiver);
    bondingBroadcastReceiver=null;
  }
}
Program: 11376
Project: 11376
Buggy source:
/** 
 * Disconnects the device by its address
 * @param deviceAddress the device address from {@link android.bluetooth.BluetoothGatt}
 */
private void disconnectByDeviceAddress(@NonNull String deviceAddress){
synchronized (bluetoothDevicesMap) {
    BluetoothDevice bluetoothDevice=bluetoothDevicesMap.get(deviceAddress);
    if (bluetoothDevice != null) {
      gattServer.cancelConnection(bluetoothDevice);
    }
    bluetoothDevicesMap.remove(deviceAddress);
  }
synchronized (midiInputDevicesMap) {
    MidiInputDevice midiInputDevice=midiInputDevicesMap.get(deviceAddress);
    if (midiInputDevice != null) {
      midiInputDevicesMap.remove(deviceAddress);
      midiInputDevice.setOnMidiInputEventListener(null);
      if (midiDeviceDetachedListener != null) {
        midiDeviceDetachedListener.onMidiInputDeviceDetached(midiInputDevice);
      }
    }
  }
synchronized (midiOutputDevicesMap) {
    MidiOutputDevice midiOutputDevice=midiOutputDevicesMap.get(deviceAddress);
    if (midiOutputDevice != null) {
      midiOutputDevicesMap.remove(deviceAddress);
      if (midiDeviceDetachedListener != null) {
        midiDeviceDetachedListener.onMidiOutputDeviceDetached(midiOutputDevice);
      }
    }
  }
}

Fixed version (ground truth):
/** 
 * Disconnects the device by its address
 * @param deviceAddress the device address from {@link android.bluetooth.BluetoothGatt}
 */
private void disconnectByDeviceAddress(@NonNull String deviceAddress){
synchronized (bluetoothDevicesMap) {
    BluetoothDevice bluetoothDevice=bluetoothDevicesMap.get(deviceAddress);
    if (bluetoothDevice != null) {
      gattServer.cancelConnection(bluetoothDevice);
    }
    bluetoothDevicesMap.remove(deviceAddress);
  }
synchronized (midiInputDevicesMap) {
    MidiInputDevice midiInputDevice=midiInputDevicesMap.get(deviceAddress);
    if (midiInputDevice != null) {
      midiInputDevicesMap.remove(deviceAddress);
      ((InternalMidiInputDevice)midiInputDevice).stop();
      midiInputDevice.setOnMidiInputEventListener(null);
      if (midiDeviceDetachedListener != null) {
        midiDeviceDetachedListener.onMidiInputDeviceDetached(midiInputDevice);
      }
    }
  }
synchronized (midiOutputDevicesMap) {
    MidiOutputDevice midiOutputDevice=midiOutputDevicesMap.get(deviceAddress);
    if (midiOutputDevice != null) {
      midiOutputDevicesMap.remove(deviceAddress);
      if (midiDeviceDetachedListener != null) {
        midiDeviceDetachedListener.onMidiOutputDeviceDetached(midiOutputDevice);
      }
    }
  }
}
Program: 11378
Project: 11378
Buggy source:
/** 
 * Terminates provider
 */
public void terminate(){
  stopAdvertising();
synchronized (bluetoothDevicesMap) {
    for (    BluetoothDevice bluetoothDevice : bluetoothDevicesMap.values()) {
      if (gattServer != null) {
        gattServer.cancelConnection(bluetoothDevice);
      }
    }
    bluetoothDevicesMap.clear();
  }
  if (gattServer != null) {
    gattServer.close();
    gattServer=null;
  }
synchronized (midiInputDevicesMap) {
    for (    MidiInputDevice midiInputDevice : midiInputDevicesMap.values()) {
      midiInputDevice.setOnMidiInputEventListener(null);
    }
    midiInputDevicesMap.clear();
  }
synchronized (midiOutputDevicesMap) {
    midiOutputDevicesMap.clear();
  }
}

Fixed version (ground truth):
/** 
 * Terminates provider
 */
public void terminate(){
  stopAdvertising();
synchronized (bluetoothDevicesMap) {
    for (    BluetoothDevice bluetoothDevice : bluetoothDevicesMap.values()) {
      if (gattServer != null) {
        gattServer.cancelConnection(bluetoothDevice);
      }
    }
    bluetoothDevicesMap.clear();
  }
  if (gattServer != null) {
    gattServer.close();
    gattServer=null;
  }
synchronized (midiInputDevicesMap) {
    for (    MidiInputDevice midiInputDevice : midiInputDevicesMap.values()) {
      ((InternalMidiInputDevice)midiInputDevice).stop();
      midiInputDevice.setOnMidiInputEventListener(null);
    }
    midiInputDevicesMap.clear();
  }
synchronized (midiOutputDevicesMap) {
    midiOutputDevicesMap.clear();
  }
}
Program: 11379
Project: 11379
Buggy source:
/** 
 * Constructor
 * @param context
 */
public BleMidiCentralProvider(final Context context){
  if (context.getPackageManager().hasSystemFeature(PackageManager.FEATURE_BLUETOOTH_LE) == false) {
    throw new UnsupportedOperationException("String_Node_Str");
  }
  bluetoothAdapter=((BluetoothManager)context.getSystemService(Context.BLUETOOTH_SERVICE)).getAdapter();
  if (bluetoothAdapter == null) {
    throw new UnsupportedOperationException("String_Node_Str");
  }
  this.context=context;
  this.midiCallback=new BleMidiCallback(context);
  this.handler=new Handler(context.getMainLooper());
  if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
    scanCallback=new ScanCallback(){
      @TargetApi(Build.VERSION_CODES.LOLLIPOP) @Override public void onScanResult(      int callbackType,      ScanResult result){
        super.onScanResult(callbackType,result);
        if (callbackType == ScanSettings.CALLBACK_TYPE_ALL_MATCHES) {
          final BluetoothDevice bluetoothDevice=result.getDevice();
          if (bluetoothDevice.getType() != BluetoothDevice.DEVICE_TYPE_LE && bluetoothDevice.getType() != BluetoothDevice.DEVICE_TYPE_DUAL) {
            return;
          }
          BluetoothGatt bluetoothGatt=bluetoothDevice.connectGatt(BleMidiCentralProvider.this.context,true,midiCallback);
          Log.i(Constants.TAG,"String_Node_Str" + bluetoothGatt.getDevice().getName());
        }
      }
    }
;
  }
 else {
    scanCallback=null;
  }
}

Fixed version (ground truth):
/** 
 * Constructor
 * @param context
 */
@SuppressLint("String_Node_Str") public BleMidiCentralProvider(final Context context){
  if (context.getPackageManager().hasSystemFeature(PackageManager.FEATURE_BLUETOOTH_LE) == false) {
    throw new UnsupportedOperationException("String_Node_Str");
  }
  bluetoothAdapter=((BluetoothManager)context.getSystemService(Context.BLUETOOTH_SERVICE)).getAdapter();
  if (bluetoothAdapter == null) {
    throw new UnsupportedOperationException("String_Node_Str");
  }
  this.context=context;
  this.midiCallback=new BleMidiCallback(context);
  this.handler=new Handler(context.getMainLooper());
  if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
    scanCallback=new ScanCallback(){
      @TargetApi(Build.VERSION_CODES.LOLLIPOP) @Override public void onScanResult(      int callbackType,      ScanResult result){
        super.onScanResult(callbackType,result);
        if (callbackType == ScanSettings.CALLBACK_TYPE_ALL_MATCHES) {
          final BluetoothDevice bluetoothDevice=result.getDevice();
          if (bluetoothDevice.getType() != BluetoothDevice.DEVICE_TYPE_LE && bluetoothDevice.getType() != BluetoothDevice.DEVICE_TYPE_DUAL) {
            return;
          }
          BluetoothGatt bluetoothGatt=bluetoothDevice.connectGatt(BleMidiCentralProvider.this.context,true,midiCallback);
          Log.i(Constants.TAG,"String_Node_Str" + bluetoothGatt.getDevice().getName());
        }
      }
    }
;
  }
 else {
    scanCallback=null;
  }
}
Program: 11380
Project: 11380
Buggy source:
/** 
 * Starts to scan devices
 * @param timeoutInMilliSeconds 0 or negative value : no timeout
 */
public void startScanDevice(int timeoutInMilliSeconds){
  if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
    bluetoothAdapter.getBluetoothLeScanner().startScan(scanCallback);
  }
 else {
    bluetoothAdapter.startLeScan(leScanCallback);
  }
  isScanning=true;
  if (onMidiScanStatusListener != null) {
    onMidiScanStatusListener.onMidiScanStatusChanged(isScanning);
  }
  if (timeoutInMilliSeconds > 0) {
    handler.postDelayed(new Runnable(){
      @Override public void run(){
        stopScanDevice();
        isScanning=false;
        if (onMidiScanStatusListener != null) {
          onMidiScanStatusListener.onMidiScanStatusChanged(isScanning);
        }
      }
    }
,timeoutInMilliSeconds);
  }
}

Fixed version (ground truth):
/** 
 * Starts to scan devices
 * @param timeoutInMilliSeconds 0 or negative value : no timeout
 */
@SuppressLint({"String_Node_Str","String_Node_Str"}) public void startScanDevice(int timeoutInMilliSeconds){
  if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
    bluetoothAdapter.getBluetoothLeScanner().startScan(scanCallback);
  }
 else {
    bluetoothAdapter.startLeScan(leScanCallback);
  }
  isScanning=true;
  if (onMidiScanStatusListener != null) {
    onMidiScanStatusListener.onMidiScanStatusChanged(isScanning);
  }
  if (timeoutInMilliSeconds > 0) {
    handler.postDelayed(new Runnable(){
      @Override public void run(){
        stopScanDevice();
        isScanning=false;
        if (onMidiScanStatusListener != null) {
          onMidiScanStatusListener.onMidiScanStatusChanged(isScanning);
        }
      }
    }
,timeoutInMilliSeconds);
  }
}
Program: 11381
Project: 11381
Buggy source:
/** 
 * Stops to scan devices
 */
public void stopScanDevice(){
  if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
    bluetoothAdapter.getBluetoothLeScanner().stopScan(scanCallback);
  }
 else {
    bluetoothAdapter.stopLeScan(leScanCallback);
  }
  isScanning=false;
  if (onMidiScanStatusListener != null) {
    onMidiScanStatusListener.onMidiScanStatusChanged(isScanning);
  }
}

Fixed version (ground truth):
/** 
 * Stops to scan devices
 */
@SuppressLint({"String_Node_Str","String_Node_Str"}) public void stopScanDevice(){
  if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
    bluetoothAdapter.getBluetoothLeScanner().stopScan(scanCallback);
  }
 else {
    bluetoothAdapter.stopLeScan(leScanCallback);
  }
  isScanning=false;
  if (onMidiScanStatusListener != null) {
    onMidiScanStatusListener.onMidiScanStatusChanged(isScanning);
  }
}
Program: 11383
Project: 11383
Buggy source:
/** 
 * SysEx
 * @param systemExclusive : start with 'F0', and end with 'F7'
 */
public final void sendMidiSystemExclusive(byte[] systemExclusive){
  byte[] timestampAddedSystemExclusive=new byte[systemExclusive.length + 2];
  System.arraycopy(systemExclusive,0,timestampAddedSystemExclusive,1,systemExclusive.length);
  timestampAddedSystemExclusive[0]=(byte)0x80;
  timestampAddedSystemExclusive[systemExclusive.length]=(byte)0x80;
  byte[] writeBuffer=new byte[20];
  writeBuffer[0]=(byte)0x80;
  for (int i=0; i < timestampAddedSystemExclusive.length; i+=19) {
    if (i + 20 <= timestampAddedSystemExclusive.length) {
      System.arraycopy(timestampAddedSystemExclusive,i,writeBuffer,1,19);
    }
 else {
      writeBuffer=new byte[timestampAddedSystemExclusive.length - i + 1];
      writeBuffer[0]=(byte)0x80;
      System.arraycopy(timestampAddedSystemExclusive,i,writeBuffer,1,timestampAddedSystemExclusive.length - i);
    }
    transferData(writeBuffer);
  }
}

Fixed version (ground truth):
/** 
 * SysEx
 * @param systemExclusive : start with 'F0', and end with 'F7'
 */
public final void sendMidiSystemExclusive(byte[] systemExclusive){
  byte[] timestampAddedSystemExclusive=new byte[systemExclusive.length + 2];
  System.arraycopy(systemExclusive,0,timestampAddedSystemExclusive,1,systemExclusive.length);
  byte[] writeBuffer=new byte[20];
  long timestamp=System.currentTimeMillis() % MAX_TIMESTAMP;
  timestampAddedSystemExclusive[0]=(byte)(0x80 | ((timestamp >> 7) & 0x3f));
  for (int i=0; i < timestampAddedSystemExclusive.length; i+=19) {
    writeBuffer[0]=(byte)(0x80 | ((timestamp >> 7) & 0x3f));
    timestampAddedSystemExclusive[systemExclusive.length]=(byte)(0x80 | (timestamp & 0x7f));
    if (i + 20 <= timestampAddedSystemExclusive.length) {
      System.arraycopy(timestampAddedSystemExclusive,i,writeBuffer,1,19);
    }
 else {
      writeBuffer=new byte[timestampAddedSystemExclusive.length - i + 1];
      System.arraycopy(timestampAddedSystemExclusive,i,writeBuffer,1,timestampAddedSystemExclusive.length - i);
    }
    transferData(writeBuffer);
    timestamp=System.currentTimeMillis() % MAX_TIMESTAMP;
  }
}
Program: 11384
Project: 11384
Buggy source:
/** 
 * Sends MIDI message to output device.
 * @param byte1 the first byte
 * @param byte2 the second byte
 * @param byte3 the third byte
 */
private void sendMidiMessage(int byte1,int byte2,int byte3){
  byte[] writeBuffer=new byte[5];
  writeBuffer[0]=(byte)0x80;
  writeBuffer[1]=(byte)0x80;
  writeBuffer[2]=(byte)byte1;
  writeBuffer[3]=(byte)byte2;
  writeBuffer[4]=(byte)byte3;
  transferData(writeBuffer);
}

Fixed version (ground truth):
/** 
 * Sends MIDI message to output device.
 * @param byte1 the first byte
 * @param byte2 the second byte
 * @param byte3 the third byte
 */
private void sendMidiMessage(int byte1,int byte2,int byte3){
  byte[] writeBuffer=new byte[5];
  long timestamp=System.currentTimeMillis() % MAX_TIMESTAMP;
  writeBuffer[0]=(byte)(0x80 | ((timestamp >> 7) & 0x3f));
  writeBuffer[1]=(byte)(0x80 | (timestamp & 0x7f));
  writeBuffer[2]=(byte)byte1;
  writeBuffer[3]=(byte)byte2;
  writeBuffer[4]=(byte)byte3;
  transferData(writeBuffer);
}
Program: 11385
Project: 11385
Buggy source:
/** 
 * Disconnect the specified device
 * @param midiOutputDevice the device
 */
void disconnectDevice(MidiOutputDevice midiOutputDevice){
synchronized (deviceAddressGattMap) {
    String deviceAddress=((jp.kshoji.blemidi.central.MidiOutputDevice)midiOutputDevice).getDeviceAddress();
    BluetoothGatt bluetoothGatt=deviceAddressGattMap.get(deviceAddress);
    if (bluetoothGatt != null) {
      bluetoothGatt.close();
      deviceAddressGattMap.remove(deviceAddress);
    }
  }
}

Fixed version (ground truth):
/** 
 * Disconnect the specified device
 * @param midiOutputDevice the device
 */
void disconnectDevice(MidiOutputDevice midiOutputDevice){
  if (!(midiOutputDevice instanceof jp.kshoji.blemidi.central.MidiOutputDevice)) {
    return;
  }
  disconnectByDeviceAddress(((jp.kshoji.blemidi.central.MidiOutputDevice)midiOutputDevice).getDeviceAddress());
}
Program: 11386
Project: 11386
Buggy source:
/** 
 * Constructor
 * @param context
 */
public BleMidiCallback(final Context context){
  super();
  this.context=context;
  this.handler=new Handler(context.getMainLooper());
}

Fixed version (ground truth):
/** 
 * Constructor
 * @param context the context
 */
public BleMidiCallback(final Context context){
  super();
  this.context=context;
  this.handler=new Handler(context.getMainLooper());
}
Program: 11388
Project: 11388
Buggy source:
/** 
 * Obtains connected input devices
 * @return Set of {@link jp.kshoji.blemidi.device.MidiInputDevice}
 */
public Set<MidiInputDevice> getMidiInputDevices(){
  Collection<Set<MidiInputDevice>> values=midiInputDevicesMap.values();
  Set<MidiInputDevice> result=new HashSet<MidiInputDevice>();
  for (  Set<MidiInputDevice> value : values) {
    result.addAll(value);
  }
  return Collections.unmodifiableSet(result);
}

Fixed version (ground truth):
/** 
 * Obtains connected input devices
 * @return Set of {@link jp.kshoji.blemidi.device.MidiInputDevice}
 */
public Set<MidiInputDevice> getMidiInputDevices(){
  Collection<Set<MidiInputDevice>> values=midiInputDevicesMap.values();
  Set<MidiInputDevice> result=new HashSet<>();
  for (  Set<MidiInputDevice> value : values) {
    result.addAll(value);
  }
  return Collections.unmodifiableSet(result);
}
Program: 11389
Project: 11389
Buggy source:
@Override public void onReceive(Context context,Intent intent){
  final String action=intent.getAction();
  if (BluetoothDevice.ACTION_BOND_STATE_CHANGED.equals(action)) {
    final int state=intent.getIntExtra(BluetoothDevice.EXTRA_BOND_STATE,BluetoothDevice.ERROR);
    Log.i(Constants.TAG,"String_Node_Str" + state);
    if (state == BluetoothDevice.BOND_BONDED) {
      context.unregisterReceiver(this);
      gattServer.connect(device,true);
      MidiInputDevice midiInputDevice=new jp.kshoji.blemidi.peripheral.MidiInputDevice(device);
      MidiOutputDevice midiOutputDevice=new jp.kshoji.blemidi.peripheral.MidiOutputDevice(device,gattServer,midiCharacteristic);
      String deviceAddress=device.getAddress();
synchronized (midiInputDevicesMap) {
        midiInputDevicesMap.put(deviceAddress,midiInputDevice);
      }
synchronized (midiOutputDevicesMap) {
        midiOutputDevicesMap.put(deviceAddress,midiOutputDevice);
      }
      if (midiDeviceAttachedListener != null) {
        midiDeviceAttachedListener.onMidiInputDeviceAttached(midiInputDevice);
        midiDeviceAttachedListener.onMidiOutputDeviceAttached(midiOutputDevice);
      }
    }
  }
}

Fixed version (ground truth):
@Override public void onReceive(Context context,Intent intent){
  final String action=intent.getAction();
  if (BluetoothDevice.ACTION_BOND_STATE_CHANGED.equals(action)) {
    final int state=intent.getIntExtra(BluetoothDevice.EXTRA_BOND_STATE,BluetoothDevice.ERROR);
    if (state == BluetoothDevice.BOND_BONDED) {
      context.unregisterReceiver(this);
      gattServer.connect(device,true);
      MidiInputDevice midiInputDevice=new jp.kshoji.blemidi.peripheral.MidiInputDevice(device);
      MidiOutputDevice midiOutputDevice=new jp.kshoji.blemidi.peripheral.MidiOutputDevice(device,gattServer,midiCharacteristic);
      String deviceAddress=device.getAddress();
synchronized (midiInputDevicesMap) {
        boolean isNewDevice=midiInputDevicesMap.get(deviceAddress) == null;
        midiInputDevicesMap.put(deviceAddress,midiInputDevice);
        if (isNewDevice) {
          if (midiDeviceAttachedListener != null) {
            midiDeviceAttachedListener.onMidiInputDeviceAttached(midiInputDevice);
          }
        }
      }
synchronized (midiOutputDevicesMap) {
        boolean isNewDevice=midiOutputDevicesMap.get(deviceAddress) == null;
        midiOutputDevicesMap.put(deviceAddress,midiOutputDevice);
        if (isNewDevice) {
          if (midiDeviceAttachedListener != null) {
            midiDeviceAttachedListener.onMidiOutputDeviceAttached(midiOutputDevice);
          }
        }
      }
    }
  }
}
Program: 11390
Project: 11390
Buggy source:
private void startAdvertising(){
  AdvertiseSettings advertiseSettings=new AdvertiseSettings.Builder().setAdvertiseMode(AdvertiseSettings.ADVERTISE_MODE_BALANCED).setTxPowerLevel(AdvertiseSettings.ADVERTISE_TX_POWER_MEDIUM).setType(AdvertiseSettings.ADVERTISE_TYPE_CONNECTABLE).build();
  List<ParcelUuid> serviceUuids=new ArrayList<ParcelUuid>();
  serviceUuids.add(new ParcelUuid(BleUuidUtils.fromString("String_Node_Str")));
  AdvertisementData advertiseData=new AdvertisementData.Builder().setIncludeTxPowerLevel(false).setServiceUuids(serviceUuids).setServiceData(new ParcelUuid(BleUuidUtils.fromString("String_Node_Str")),"String_Node_Str".getBytes()).build();
  bluetoothLeAdvertiser.startAdvertising(advertiseSettings,advertiseData,advertiseCallback);
}

Fixed version (ground truth):
private void startAdvertising(){
  AdvertiseSettings advertiseSettings=new AdvertiseSettings.Builder().setAdvertiseMode(AdvertiseSettings.ADVERTISE_MODE_BALANCED).setTxPowerLevel(AdvertiseSettings.ADVERTISE_TX_POWER_MEDIUM).setConnectable(true).build();
  List<ParcelUuid> serviceUuids=new ArrayList<ParcelUuid>();
  AdvertiseData advertiseData=new AdvertiseData.Builder().setIncludeTxPowerLevel(false).addServiceUuid(new ParcelUuid(BleUuidUtils.fromString("String_Node_Str"))).build();
  bluetoothLeAdvertiser.startAdvertising(advertiseSettings,advertiseData,advertiseCallback);
}
Program: 11391
Project: 11391
Buggy source:
/** 
 * Use this function when your drawing point X touched right end. Copies right rect area to left end and recalculates drawing point X
 * @return	New drawing point X
 */
private int moveTimeLine(){
  int howManyPointInScreen=mViewW / POINT_WIDTH;
  int cutPoint=howManyPointInScreen / GRID_UNIT_SIZE / 3;
  int cutPointX=mCurrentDrawingX - POINT_WIDTH - cutPoint * GRID_UNIT_SIZE * POINT_WIDTH;
  int cutWidth=mBitmap.getWidth() - cutPointX;
  if (cutPointX <= 0 || cutPointX >= cutWidth) {
    mPaint.setColor(0xFFb1b1b1);
    mCanvas.drawLine(0,mViewH / 2,mViewW,mViewH / 2,mPaint);
    mCurrentDrawingX=0;
    return 0;
  }
  Bitmap bCut=Bitmap.createBitmap(mBitmap,cutPointX,0,cutWidth,mViewH);
  mCanvas.drawColor(Color.WHITE);
  mCanvas.drawBitmap(bCut,0,0,null);
  mPaint.setColor(0xFFb1b1b1);
  mCanvas.drawLine(cutPoint * GRID_UNIT_SIZE * POINT_WIDTH,mViewH / 2,mViewW,mViewH / 2,mPaint);
  mCurrentDrawingX=1 + cutPoint * GRID_UNIT_SIZE * POINT_WIDTH;
  bCut=null;
  return cutPoint * GRID_UNIT_SIZE * POINT_WIDTH;
}

Fixed version (ground truth):
/** 
 * Use this function when your drawing point X touched right end. Copies right rect area to left end and recalculates drawing point X
 * @return	New drawing point X
 */
private int moveTimeLine(){
  int howManyPointInScreen=mViewW / POINT_WIDTH;
  int cutPoint=howManyPointInScreen / GRID_UNIT_SIZE / 3;
  int cutPointX=mCurrentDrawingX - POINT_WIDTH - cutPoint * GRID_UNIT_SIZE * POINT_WIDTH;
  int cutWidth=mBitmap.getWidth() - cutPointX;
  if (cutPointX <= 0 || cutPointX + cutWidth >= mBitmap.getWidth()) {
    mCanvas.drawColor(Color.WHITE);
    mPaint.setColor(0xFFb1b1b1);
    mCanvas.drawLine(0,mViewH / 2,mViewW,mViewH / 2,mPaint);
    mCurrentDrawingX=0;
    return 0;
  }
  Bitmap bCut=Bitmap.createBitmap(mBitmap,cutPointX,0,cutWidth,mViewH);
  mCanvas.drawColor(Color.WHITE);
  mCanvas.drawBitmap(bCut,0,0,null);
  mPaint.setColor(0xFFb1b1b1);
  mCanvas.drawLine(cutPoint * GRID_UNIT_SIZE * POINT_WIDTH,mViewH / 2,mViewW,mViewH / 2,mPaint);
  mCurrentDrawingX=1 + cutPoint * GRID_UNIT_SIZE * POINT_WIDTH;
  bCut=null;
  return cutPoint * GRID_UNIT_SIZE * POINT_WIDTH;
}
Program: 11392
Project: 11392
Buggy source:
/** 
 * Decorates projects by using   {@link #updateByXml(P,Source)} and saving the configuration,rather than only updating the project in memory.
 * @param project the project to decorate
 * @return the project that was just decorated
 */
@Override public P decorate(P project){
  if (!isProject(project)) {
    return project;
  }
  if (!(getOwner() instanceof TemplateDrivenMultiBranchProject)) {
    throw new IllegalStateException(String.format("String_Node_Str",TemplateDrivenBranchProjectFactory.class.getSimpleName(),TemplateDrivenMultiBranchProject.class.getSimpleName()));
  }
  TemplateDrivenMultiBranchProject<P,B> owner=(TemplateDrivenMultiBranchProject<P,B>)getOwner();
  Branch branch=getBranch(project);
  String displayName=project.getDisplayNameOrNull();
  boolean wasDisabled=project.isDisabled();
  BulkChange bc=new BulkChange(project);
  try {
    updateByXml(project,new StreamSource(owner.getTemplate().getConfigFile().readRaw()));
    setBranch(project,branch);
    project.setDisplayName(displayName);
    project.setScm(branch.getScm());
    project.setBuildDiscarder(owner.getTemplate().getBuildDiscarder());
    project.setCustomWorkspace(owner.getTemplate().getCustomWorkspace());
    if (!wasDisabled) {
      project.enable();
    }
    project=super.decorate(project);
    bc.commit();
  }
 catch (  IOException e) {
    LOGGER.log(Level.WARNING,"String_Node_Str" + project.getName(),e);
  }
 finally {
    bc.abort();
  }
  return project;
}

Fixed version (ground truth):
/** 
 * Decorates projects by using   {@link #updateByXml(AbstractProject,Source)} and saving the configuration,rather than only updating the project in memory.
 * @param project the project to decorate
 * @return the project that was just decorated
 */
@Override public P decorate(P project){
  if (!isProject(project)) {
    return project;
  }
  if (!(getOwner() instanceof TemplateDrivenMultiBranchProject)) {
    throw new IllegalStateException(String.format("String_Node_Str",TemplateDrivenBranchProjectFactory.class.getSimpleName(),TemplateDrivenMultiBranchProject.class.getSimpleName()));
  }
  TemplateDrivenMultiBranchProject<P,B> owner=(TemplateDrivenMultiBranchProject<P,B>)getOwner();
  Branch branch=getBranch(project);
  String displayName=project.getDisplayNameOrNull();
  boolean wasDisabled=project.isDisabled();
  BulkChange bc=new BulkChange(project);
  try {
    updateByXml(project,new StreamSource(owner.getTemplate().getConfigFile().readRaw()));
    setBranch(project,branch);
    project.setDisplayName(displayName);
    project.setScm(branch.getScm());
    project.setBuildDiscarder(owner.getTemplate().getBuildDiscarder());
    project.setCustomWorkspace(owner.getTemplate().getCustomWorkspace());
    if (!wasDisabled) {
      project.enable();
    }
    project=super.decorate(project);
    bc.commit();
  }
 catch (  IOException e) {
    LOGGER.log(Level.WARNING,"String_Node_Str" + project.getName(),e);
  }
 finally {
    bc.abort();
  }
  return project;
}
Program: 11397
Project: 11397
Buggy source:
private void saveElevation(final int x0,final int xN,final int y0,final int yN,final double[][] elevation,final ProductContainer product,final Map<Band,Tile> targetTileMap){
  final Band elevationBand=targetProduct.getBand(product.getBandName(ELEVATION));
  final Tile elevationTile=targetTileMap.get(elevationBand);
  final ProductData elevationData=elevationTile.getDataBuffer();
  final TileIndex tgtIndex=new TileIndex(elevationTile);
  for (int y=y0; y <= yN; y++) {
    tgtIndex.calculateStride(y);
    final int yy=y - y0;
    for (int x=x0; x <= xN; x++) {
      final int tgtIdx=tgtIndex.getIndex(x);
      final int xx=x - x0;
      elevationData.setElemFloatAt(tgtIdx,(float)elevation[yy][xx]);
    }
  }
}

Fixed version (ground truth):
private void saveElevation(final int x0,final int xN,final int y0,final int yN,final double[][] elevation,final ProductContainer product,final Map<Band,Tile> targetTileMap){
  if (product.getBandName(ELEVATION) == null) {
    return;
  }
  final Band elevationBand=targetProduct.getBand(product.getBandName(ELEVATION));
  final Tile elevationTile=targetTileMap.get(elevationBand);
  final ProductData elevationData=elevationTile.getDataBuffer();
  final TileIndex tgtIndex=new TileIndex(elevationTile);
  for (int y=y0; y <= yN; y++) {
    tgtIndex.calculateStride(y);
    final int yy=y - y0;
    for (int x=x0; x <= xN; x++) {
      final int tgtIdx=tgtIndex.getIndex(x);
      final int xx=x - x0;
      elevationData.setElemFloatAt(tgtIdx,(float)elevation[yy][xx]);
    }
  }
}
Program: 11400
Project: 11400
Buggy source:
private void constructTargetMetadata(){
  for (  String keyMaster : masterMap.keySet()) {
    CplxContainer master=masterMap.get(keyMaster);
    for (    String keySlave : slaveMap.keySet()) {
      final CplxContainer slave=slaveMap.get(keySlave);
      if (master.polarisation.equals(slave.polarisation)) {
        String productName=keyMaster + '_' + keySlave;
        final ProductContainer product=new ProductContainer(productName,master,slave,true);
        targetMap.put(productName,product);
      }
    }
  }
}

Fixed version (ground truth):
private void constructTargetMetadata(){
  for (  String keyMaster : masterMap.keySet()) {
    CplxContainer master=masterMap.get(keyMaster);
    for (    String keySlave : slaveMap.keySet()) {
      final CplxContainer slave=slaveMap.get(keySlave);
      if (master.polarisation == null || master.polarisation.equals(slave.polarisation)) {
        String productName=keyMaster + '_' + keySlave;
        final ProductContainer product=new ProductContainer(productName,master,slave,true);
        targetMap.put(productName,product);
      }
    }
  }
}
Program: 11406
Project: 11406
Buggy source:
private int getOutputClusterIndex(final int x,final int y){
  return mask[y][x] < -64 ? pvColourIndexMap[mask[y][x] + 128] : mask[y][x] < 0 ? pdColourIndexMap[mask[y][x] + 64] : psColourIndexMap[mask[y][x]];
}

Fixed version (ground truth):
private int getOutputClusterIndex(final int x,final int y){
  return category[y][x] == Categories.vol ? pvColourIndexMap[cluster[y][x]] : category[y][x] == Categories.dbl ? pdColourIndexMap[cluster[y][x]] : psColourIndexMap[cluster[y][x]];
}
Program: 11408
Project: 11408
Buggy source:
/** 
 * Compute centers for all numClasses clusters
 * @param srcBandList the input bands
 * @param op          the operator
 */
private synchronized void computeTerrainClusterCenters(final PolBandUtils.PolSourceBand srcBandList,final PolarimetricClassificationOp op){
  if (clusterCentersComputed) {
    return;
  }
  mask=new byte[srcHeight][srcWidth];
  final double[][] fdd=new double[srcHeight][srcWidth];
  final java.util.List<ClusterInfo> pvCenterList=new ArrayList<>(numInitialClusters);
  final java.util.List<ClusterInfo> pdCenterList=new ArrayList<>(numInitialClusters);
  final java.util.List<ClusterInfo> psCenterList=new ArrayList<>(numInitialClusters);
  maxClusterSize=2 * srcHeight * srcWidth / numFinalClasses;
  final Dimension tileSize=new Dimension(256,256);
  final Rectangle[] tileRectangles=OperatorUtils.getAllTileRectangles(op.getSourceProduct(),tileSize,0);
  computeInitialTerrainClusterCenters(fdd,pvCenterList,pdCenterList,psCenterList,srcBandList,tileRectangles,op);
  computeFinalTerrainClusterCenters(fdd,pvCenterList,pdCenterList,psCenterList,srcBandList,tileRectangles,op);
  clusterCentersComputed=true;
}

Fixed version (ground truth):
/** 
 * Compute centers for all numClasses clusters
 * @param srcBandList the input bands
 * @param op          the operator
 */
private synchronized void computeTerrainClusterCenters(final PolBandUtils.PolSourceBand srcBandList,final PolarimetricClassificationOp op){
  if (clusterCentersComputed) {
    return;
  }
  category=new Categories[srcHeight][srcWidth];
  cluster=new int[srcHeight][srcWidth];
  final double[][] fdd=new double[srcHeight][srcWidth];
  final java.util.List<ClusterInfo> pvCenterList=new ArrayList<>(numInitialClusters);
  final java.util.List<ClusterInfo> pdCenterList=new ArrayList<>(numInitialClusters);
  final java.util.List<ClusterInfo> psCenterList=new ArrayList<>(numInitialClusters);
  maxClusterSize=2 * srcHeight * srcWidth / numFinalClasses;
  final Dimension tileSize=new Dimension(256,256);
  final Rectangle[] tileRectangles=OperatorUtils.getAllTileRectangles(op.getSourceProduct(),tileSize,0);
  computeInitialTerrainClusterCenters(fdd,pvCenterList,pdCenterList,psCenterList,srcBandList,tileRectangles,op);
  computeFinalTerrainClusterCenters(fdd,pvCenterList,pdCenterList,psCenterList,srcBandList,tileRectangles,op);
  clusterCentersComputed=true;
}
Program: 11415
Project: 11415
Buggy source:
/** 
 * Get elevation model.
 * @throws Exception The exceptions.
 */
private synchronized void getElevationModel() throws Exception {
  if (isElevationModelAvailable)   return;
  try {
    if (externalDEMFile != null) {
      dem=new FileElevationModel(externalDEMFile,demResamplingMethod,externalDEMNoDataValue);
      demNoDataValue=externalDEMNoDataValue;
      demName=externalDEMFile.getPath();
      try {
        demSamplingLat=Math.abs(dem.getGeoPos(new PixelPos(1,0)).getLat() - dem.getGeoPos(new PixelPos(0,0)).getLat());
        demSamplingLon=Math.abs(dem.getGeoPos(new PixelPos(0,1)).getLat() - dem.getGeoPos(new PixelPos(0,0)).getLat());
      }
 catch (      Exception e) {
        throw new OperatorException("String_Node_Str" + demName + "String_Node_Str");
      }
    }
 else {
      dem=DEMFactory.createElevationModel(demName,demResamplingMethod);
      demNoDataValue=dem.getDescriptor().getNoDataValue();
      demSamplingLat=(double)dem.getDescriptor().getTileWidthInDegrees() / (double)dem.getDescriptor().getTileWidth();
      demSamplingLon=demSamplingLat;
    }
  }
 catch (  Throwable t) {
    SystemUtils.LOG.severe("String_Node_Str" + t.getMessage());
  }
  isElevationModelAvailable=true;
}

Fixed version (ground truth):
/** 
 * Get elevation model.
 * @throws Exception The exceptions.
 */
private synchronized void getElevationModel() throws Exception {
  if (isElevationModelAvailable)   return;
  try {
    if (externalDEMFile != null) {
      dem=new FileElevationModel(externalDEMFile,demResamplingMethod,externalDEMNoDataValue);
      demNoDataValue=externalDEMNoDataValue;
      demName=externalDEMFile.getPath();
      try {
        demSamplingLat=Math.abs(dem.getGeoPos(new PixelPos(0,1)).getLat() - dem.getGeoPos(new PixelPos(0,0)).getLat());
        demSamplingLon=Math.abs(dem.getGeoPos(new PixelPos(1,0)).getLon() - dem.getGeoPos(new PixelPos(0,0)).getLon());
      }
 catch (      Exception e) {
        throw new OperatorException("String_Node_Str" + demName + "String_Node_Str");
      }
    }
 else {
      dem=DEMFactory.createElevationModel(demName,demResamplingMethod);
      demNoDataValue=dem.getDescriptor().getNoDataValue();
      demSamplingLat=(double)dem.getDescriptor().getTileWidthInDegrees() / (double)dem.getDescriptor().getTileWidth();
      demSamplingLon=demSamplingLat;
    }
  }
 catch (  Throwable t) {
    SystemUtils.LOG.severe("String_Node_Str" + t.getMessage());
  }
  isElevationModelAvailable=true;
}
Program: 11416
Project: 11416
Buggy source:
private String writeStartTime(){
  double diff=srcProduct.getStartTime().getMJD() - dateDay.getMJD();
  double seconds=diff * daysToSeconds;
  return seconds + sep + "String_Node_Str";
}

Fixed version (ground truth):
private String writeStartTime(){
  double diff=srcProduct.getStartTime().getMJD() - dateDay.getMJD();
  double seconds=diff * daysToSeconds;
  return seconds + tab + "String_Node_Str";
}
Program: 11417
Project: 11417
Buggy source:
private String writeEndTime(){
  double diff=srcProduct.getEndTime().getMJD() - dateDay.getMJD();
  double seconds=diff * daysToSeconds;
  return seconds + sep + "String_Node_Str";
}

Fixed version (ground truth):
private String writeEndTime(){
  double diff=srcProduct.getEndTime().getMJD() - dateDay.getMJD();
  double seconds=diff * daysToSeconds;
  return seconds + tab + "String_Node_Str";
}
Program: 11418
Project: 11418
Buggy source:
private void writeOrbitStateVectors(final PrintStream p){
  final OrbitStateVector[] osvList=AbstractMetadata.getOrbitStateVectors(absRoot);
  if (osvList != null && osvList.length > 0) {
    double seconds=(osvList[0].time_mjd - dateDay.getMJD()) * daysToSeconds;
    double seconds2=(osvList[1].time_mjd - dateDay.getMJD()) * daysToSeconds;
    double interval=seconds2 - seconds;
    p.println(GammaConstants.HEADER_KEY_NUM_STATE_VECTORS + sep + osvList.length);
    p.println(GammaConstants.HEADER_KEY_TIME_FIRST_STATE_VECTORS + sep + seconds+ sep+ "String_Node_Str");
    p.println(GammaConstants.HEADER_KEY_STATE_VECTOR_INTERVAL + sep + interval+ sep+ "String_Node_Str");
    int num=1;
    for (    OrbitStateVector osv : osvList) {
      p.println(GammaConstants.HEADER_KEY_STATE_VECTOR_POSITION + '_' + num+ sep+ osv.x_pos+ sep+ osv.y_pos+ sep+ osv.z_pos+ sep+ "String_Node_Str");
      p.println(GammaConstants.HEADER_KEY_STATE_VECTOR_VELOCITY + '_' + num+ sep+ osv.x_vel+ sep+ osv.y_vel+ sep+ osv.z_vel+ sep+ "String_Node_Str");
      ++num;
    }
  }
}

Fixed version (ground truth):
private void writeOrbitStateVectors(final PrintStream p){
  final OrbitStateVector[] osvList=AbstractMetadata.getOrbitStateVectors(absRoot);
  if (osvList != null && osvList.length > 0) {
    double seconds=(osvList[0].time_mjd - dateDay.getMJD()) * daysToSeconds;
    double seconds2=(osvList[1].time_mjd - dateDay.getMJD()) * daysToSeconds;
    double interval=seconds2 - seconds;
    p.println(GammaConstants.HEADER_KEY_NUM_STATE_VECTORS + sep + osvList.length);
    p.println(GammaConstants.HEADER_KEY_TIME_FIRST_STATE_VECTORS + sep + seconds+ tab+ "String_Node_Str");
    p.println(GammaConstants.HEADER_KEY_STATE_VECTOR_INTERVAL + sep + interval+ tab+ "String_Node_Str");
    int num=1;
    for (    OrbitStateVector osv : osvList) {
      p.println(GammaConstants.HEADER_KEY_STATE_VECTOR_POSITION + '_' + num+ sep+ osv.x_pos+ tab+ osv.y_pos+ tab+ osv.z_pos+ tab+ "String_Node_Str");
      p.println(GammaConstants.HEADER_KEY_STATE_VECTOR_VELOCITY + '_' + num+ sep+ osv.x_vel+ tab+ osv.y_vel+ tab+ osv.z_vel+ tab+ "String_Node_Str");
      ++num;
    }
  }
}
Program: 11419
Project: 11419
Buggy source:
private String writeCenterTime(){
  double center=(srcProduct.getStartTime().getMJD() + (srcProduct.getEndTime().getMJD() - srcProduct.getStartTime().getMJD()) / 2.0);
  double seconds=(center - dateDay.getMJD()) * daysToSeconds;
  return seconds + sep + "String_Node_Str";
}

Fixed version (ground truth):
private String writeCenterTime(){
  double center=(srcProduct.getStartTime().getMJD() + (srcProduct.getEndTime().getMJD() - srcProduct.getStartTime().getMJD()) / 2.0);
  double seconds=(center - dateDay.getMJD()) * daysToSeconds;
  return seconds + tab + "String_Node_Str";
}
Program: 11421
Project: 11421
Buggy source:
private void writeCenterLatLon(final PrintStream p){
  GeoPos geoPos=srcProduct.getSceneGeoCoding().getGeoPos(new PixelPos(srcProduct.getSceneRasterWidth() / 2,srcProduct.getSceneRasterHeight() / 2),null);
  p.println(GammaConstants.HEADER_KEY_CENTER_LATITUDE + sep + geoPos.getLat()+ sep+ "String_Node_Str");
  p.println(GammaConstants.HEADER_KEY_CENTER_LONGITUDE + sep + geoPos.getLon()+ sep+ "String_Node_Str");
  GeoPos geoPos2=srcProduct.getSceneGeoCoding().getGeoPos(new PixelPos(srcProduct.getSceneRasterWidth() / 2,(srcProduct.getSceneRasterHeight() / 2) + 100),null);
  GeoUtils.DistanceHeading heading=GeoUtils.vincenty_inverse(geoPos.lat,geoPos.lon,geoPos2.lat,geoPos2.lon);
  p.println(GammaConstants.HEADER_KEY_HEADING + sep + heading.heading1+ sep+ "String_Node_Str");
}

Fixed version (ground truth):
private void writeCenterLatLon(final PrintStream p){
  GeoPos geoPos=srcProduct.getSceneGeoCoding().getGeoPos(new PixelPos(srcProduct.getSceneRasterWidth() / 2,srcProduct.getSceneRasterHeight() / 2),null);
  p.println(GammaConstants.HEADER_KEY_CENTER_LATITUDE + sep + geoPos.getLat()+ tab+ "String_Node_Str");
  p.println(GammaConstants.HEADER_KEY_CENTER_LONGITUDE + sep + geoPos.getLon()+ tab+ "String_Node_Str");
  GeoPos geoPos2=srcProduct.getSceneGeoCoding().getGeoPos(new PixelPos(srcProduct.getSceneRasterWidth() / 2,(srcProduct.getSceneRasterHeight() / 2) + 100),null);
  GeoUtils.DistanceHeading heading=GeoUtils.vincenty_inverse(geoPos.lat,geoPos.lon,geoPos2.lat,geoPos2.lon);
  p.println(GammaConstants.HEADER_KEY_HEADING + sep + heading.heading1+ tab+ "String_Node_Str");
}
Program: 11422
Project: 11422
Buggy source:
private Band getComplexSrcBand(final Band iBand){
  String name=iBand.getName();
  if (name.startsWith("String_Node_Str")) {
    name.replace("String_Node_Str","String_Node_Str");
  }
 else   if (name.startsWith("String_Node_Str")) {
    name.replace("String_Node_Str","String_Node_Str");
  }
  return srcProduct.getBand(name);
}

Fixed version (ground truth):
private Band getComplexSrcBand(final Band iBand){
  String name=iBand.getName();
  if (name.startsWith("String_Node_Str")) {
    name=name.replace("String_Node_Str","String_Node_Str");
  }
 else   if (name.startsWith("String_Node_Str")) {
    name=name.replace("String_Node_Str","String_Node_Str");
  }
  return srcProduct.getBand(name);
}
Program: 11424
Project: 11424
Buggy source:
/** 
 * Compute Perform Freeman-Durden decomposition for given covariance matrix C3
 * @param Cr Real part of the covariance matrix
 * @param Ci Imaginary part of the covariance matrix
 * @return The Freeman-Durden decomposition result
 */
public static FDD getFreemanDurdenDecomposition(final double[][] Cr,final double[][] Ci){
  double fd, fv, fs, pd, pv, ps, c11, c13Re, c13Im, c33, alphaRe, alphaIm, betaRe, betaIm;
  fv=4.0 * Cr[1][1];
  c11=Cr[0][0] - fv * 3.0 / 8.0;
  c13Re=Cr[0][2] - fv / 8.0;
  c13Im=Ci[0][2];
  c33=Cr[2][2] - fv * 3.0 / 8.0;
  final double a1=c11 * c33;
  if (Math.abs(c11) <= Constants.EPS || Math.abs(c33) <= Constants.EPS) {
    fs=0.0;
    fd=0.0;
    alphaRe=0.0;
    alphaIm=0.0;
    betaRe=0.0;
    betaIm=0.0;
  }
 else {
    final double a2=c13Re * c13Re + c13Im * c13Im;
    if (a1 < a2) {
      final double c13=Math.sqrt(a2);
      c13Re=Math.sqrt(a1) * c13Re / c13;
      c13Im=Math.sqrt(a1) * c13Im / c13;
    }
    if (c13Re < 0.0) {
      betaRe=1.0;
      betaIm=0.0;
      fs=Math.abs((a1 - c13Re * c13Re - c13Im * c13Im) / (c11 + c33 - 2 * c13Re));
      fd=Math.abs(c33 - fs);
      alphaRe=(c13Re - fs) / fd;
      alphaIm=c13Im / fd;
    }
 else {
      alphaRe=-1.0;
      alphaIm=0.0;
      fd=Math.abs((a1 - c13Re * c13Re - c13Im * c13Im) / (c11 + c33 + 2 * c13Re));
      fs=Math.abs(c33 - fd);
      betaRe=(c13Re + fd) / fs;
      betaIm=c13Im / fs;
    }
  }
  ps=fs * (1 + betaRe * betaRe + betaIm * betaIm);
  pd=fd * (1 + alphaRe * alphaRe + alphaIm * alphaIm);
  pv=fv;
  return new FDD(pv,pd,ps);
}

Fixed version (ground truth):
/** 
 * Compute Perform Freeman-Durden decomposition for given covariance matrix C3
 * @param Cr Real part of the covariance matrix
 * @param Ci Imaginary part of the covariance matrix
 * @return The Freeman-Durden decomposition result
 */
public static FDD getFreemanDurdenDecomposition(final double[][] Cr,final double[][] Ci){
  double fd, fv, fs, pd, pv, ps, c11, c13Re, c13Im, c33, alphaRe, alphaIm, betaRe, betaIm;
  fv=4.0 * Cr[1][1];
  c11=Cr[0][0] - fv * 3.0 / 8.0;
  c13Re=Cr[0][2] - fv / 8.0;
  c13Im=Ci[0][2];
  c33=Cr[2][2] - fv * 3.0 / 8.0;
  final double a1=c11 * c33;
  if (c11 <= Constants.EPS || c33 <= Constants.EPS) {
    fs=0.0;
    fd=0.0;
    alphaRe=0.0;
    alphaIm=0.0;
    betaRe=0.0;
    betaIm=0.0;
  }
 else {
    final double a2=c13Re * c13Re + c13Im * c13Im;
    if (a1 < a2) {
      final double c13=Math.sqrt(a2);
      c13Re=Math.sqrt(a1) * c13Re / c13;
      c13Im=Math.sqrt(a1) * c13Im / c13;
    }
    if (c13Re < 0.0) {
      betaRe=1.0;
      betaIm=0.0;
      fs=Math.abs((a1 - c13Re * c13Re - c13Im * c13Im) / (c11 + c33 - 2 * c13Re));
      fd=Math.abs(c33 - fs);
      alphaRe=(c13Re - fs) / fd;
      alphaIm=c13Im / fd;
    }
 else {
      alphaRe=-1.0;
      alphaIm=0.0;
      fd=Math.abs((a1 - c13Re * c13Re - c13Im * c13Im) / (c11 + c33 + 2 * c13Re));
      fs=Math.abs(c33 - fd);
      betaRe=(c13Re + fd) / fs;
      betaIm=c13Im / fs;
    }
  }
  ps=fs * (1 + betaRe * betaRe + betaIm * betaIm);
  pd=fd * (1 + alphaRe * alphaRe + alphaIm * alphaIm);
  pv=fv;
  return new FDD(pv,pd,ps);
}
Program: 11426
Project: 11426
Buggy source:
public void focusLost(final FocusEvent e){
  Double pixM=0.0, pixD=0.0;
  try {
    pixD=Double.parseDouble(pixelSpacingInDegree.getText());
    if (pixD != pixDSaved) {
      pixM=SARGeocoding.getPixelSpacingInMeter(pixD);
      pixelSpacingInMeter.setText(String.valueOf(pixM));
      pixMSaved=pixM;
      pixDSaved=pixD;
    }
  }
 catch (  Exception ec) {
    pixM=0.0;
  }
}

Fixed version (ground truth):
public void focusLost(final FocusEvent e){
  Double pixM=0.0, pixD=0.0;
  try {
    pixD=Double.parseDouble(pixelSpacingInDegree.getText());
    if (Double.compare(pixD,pixDSaved) != 0) {
      pixM=SARGeocoding.getPixelSpacingInMeter(pixD);
      pixelSpacingInMeter.setText(String.valueOf(pixM));
      pixMSaved=pixM;
      pixDSaved=pixD;
    }
  }
 catch (  Exception ec) {
    pixM=0.0;
  }
}
Program: 11428
Project: 11428
Buggy source:
public ImageIOFile.BandInfo getBandInfo(final Band destBand){
  return bandMap.get(destBand);
}

Fixed version (ground truth):
public ImageIOFile.BandInfo getBandInfo(final Band destBand){
  ImageIOFile.BandInfo bandInfo=bandMap.get(destBand);
  if (bandInfo == null) {
    for (    Band srcBand : bandMap.keySet()) {
      if (srcBand.getName().equals(destBand.getName())) {
        bandInfo=bandMap.get(srcBand);
      }
    }
  }
  return bandInfo;
}