Program: 161425
Project: 161425
Buggy source:
@Override protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS);
  setContentView(R.layout.device_list);
  setResult(Activity.RESULT_CANCELED);
  Button scanButton=(Button)findViewById(R.id.button_scan);
  scanButton.setOnClickListener(new OnClickListener(){
    public void onClick(    View v){
      doDiscovery();
      v.setVisibility(View.GONE);
    }
  }
);
  mPairedDevicesArrayAdapter=new ArrayAdapter<String>(this,R.layout.device_name);
  mNewDevicesArrayAdapter=new ArrayAdapter<String>(this,R.layout.device_name);
  ListView pairedListView=(ListView)findViewById(R.id.paired_devices);
  pairedListView.setAdapter(mPairedDevicesArrayAdapter);
  pairedListView.setOnItemClickListener(mDeviceClickListener);
  ListView newDevicesListView=(ListView)findViewById(R.id.new_devices);
  newDevicesListView.setAdapter(mNewDevicesArrayAdapter);
  newDevicesListView.setOnItemClickListener(mDeviceClickListener);
  IntentFilter filter=new IntentFilter(BluetoothDevice.ACTION_FOUND);
  this.registerReceiver(mReceiver,filter);
  filter=new IntentFilter(BluetoothAdapter.ACTION_DISCOVERY_FINISHED);
  this.registerReceiver(mReceiver,filter);
  mBtAdapter=BluetoothAdapter.getDefaultAdapter();
  Set<BluetoothDevice> pairedDevices=mBtAdapter.getBondedDevices();
  if (pairedDevices.size() > 0) {
    findViewById(R.id.title_paired_devices).setVisibility(View.VISIBLE);
    for (    BluetoothDevice device : pairedDevices) {
      mPairedDevicesArrayAdapter.add(device.getName() + "String_Node_Str" + device.getAddress());
    }
  }
 else {
    String noDevices=getResources().getText(R.string.none_paired).toString();
    mPairedDevicesArrayAdapter.add(noDevices);
  }
}

Fixed version (ground truth):
@Override protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS);
  setContentView(R.layout.device_list);
  setResult(Activity.RESULT_CANCELED);
  scanButton=(Button)findViewById(R.id.button_scan);
  scanButton.setOnClickListener(new OnClickListener(){
    public void onClick(    View v){
      doDiscovery();
      v.setVisibility(View.GONE);
    }
  }
);
  mPairedDevicesArrayAdapter=new ArrayAdapter<String>(this,R.layout.device_name);
  mNewDevicesArrayAdapter=new ArrayAdapter<String>(this,R.layout.device_name);
  mNewDevicesSet=new HashSet<String>();
  ListView pairedListView=(ListView)findViewById(R.id.paired_devices);
  pairedListView.setAdapter(mPairedDevicesArrayAdapter);
  pairedListView.setOnItemClickListener(mDeviceClickListener);
  ListView newDevicesListView=(ListView)findViewById(R.id.new_devices);
  newDevicesListView.setAdapter(mNewDevicesArrayAdapter);
  newDevicesListView.setOnItemClickListener(mDeviceClickListener);
  IntentFilter filter=new IntentFilter(BluetoothDevice.ACTION_FOUND);
  this.registerReceiver(mReceiver,filter);
  filter=new IntentFilter(BluetoothAdapter.ACTION_DISCOVERY_FINISHED);
  this.registerReceiver(mReceiver,filter);
  mBtAdapter=BluetoothAdapter.getDefaultAdapter();
  Set<BluetoothDevice> pairedDevices=mBtAdapter.getBondedDevices();
  if (pairedDevices.size() > 0) {
    findViewById(R.id.title_paired_devices).setVisibility(View.VISIBLE);
    for (    BluetoothDevice device : pairedDevices) {
      mPairedDevicesArrayAdapter.add(device.getName() + "String_Node_Str" + device.getAddress());
    }
  }
 else {
    String noDevices=getResources().getText(R.string.none_paired).toString();
    mPairedDevicesArrayAdapter.add(noDevices);
  }
}