Program: 32018
Project: 32018
Buggy source:
/** 
 * Set the devices as known
 * @param devices  the devices
 * @param callback the as
 */
public void setDevicesKnown(final List<MXDeviceInfo> devices,final ApiCallback<Void> callback){
  if (hasBeenReleased()) {
    return;
  }
  getEncryptingThreadHandler().post(new Runnable(){
    @Override public void run(){
      Map<String,List<String>> devicesIdListByUserId=new HashMap<>();
      for (      MXDeviceInfo di : devices) {
        List<String> deviceIdsList=devicesIdListByUserId.get(di.userId);
        if (null == deviceIdsList) {
          deviceIdsList=new ArrayList<>();
          devicesIdListByUserId.put(di.userId,deviceIdsList);
        }
        deviceIdsList.add(di.deviceId);
      }
      Set<String> userIds=devicesIdListByUserId.keySet();
      for (      String userId : userIds) {
        Map<String,MXDeviceInfo> storedDeviceIDs=mCryptoStore.getUserDevices(userId);
        if (null != storedDeviceIDs) {
          boolean isUpdated=false;
          List<String> deviceIds=devicesIdListByUserId.get(userId);
          for (          String deviceId : deviceIds) {
            MXDeviceInfo device=storedDeviceIDs.get(deviceId);
            if (device.isUnknown()) {
              device.mVerified=MXDeviceInfo.DEVICE_VERIFICATION_UNVERIFIED;
              isUpdated=true;
            }
          }
          if (isUpdated) {
            mCryptoStore.storeUserDevices(userId,storedDeviceIDs);
          }
        }
      }
      if (null != callback) {
        getUIHandler().post(new Runnable(){
          @Override public void run(){
            callback.onSuccess(null);
          }
        }
);
      }
    }
  }
);
}

Fixed version (ground truth):
/** 
 * Set the devices as known
 * @param devices  the devices
 * @param callback the as
 */
public void setDevicesKnown(final List<MXDeviceInfo> devices,final ApiCallback<Void> callback){
  if (hasBeenReleased()) {
    return;
  }
  getEncryptingThreadHandler().post(new Runnable(){
    @Override public void run(){
      Map<String,List<String>> devicesIdListByUserId=new HashMap<>();
      for (      MXDeviceInfo di : devices) {
        List<String> deviceIdsList=devicesIdListByUserId.get(di.userId);
        if (null == deviceIdsList) {
          deviceIdsList=new ArrayList<>();
          devicesIdListByUserId.put(di.userId,deviceIdsList);
        }
        deviceIdsList.add(di.deviceId);
      }
      Set<String> userIds=devicesIdListByUserId.keySet();
      for (      String userId : userIds) {
        Map<String,MXDeviceInfo> storedDeviceIDs=mCryptoStore.getUserDevices(userId);
        if (null != storedDeviceIDs) {
          boolean isUpdated=false;
          List<String> deviceIds=devicesIdListByUserId.get(userId);
          for (          String deviceId : deviceIds) {
            MXDeviceInfo device=storedDeviceIDs.get(deviceId);
            if ((null != device) && device.isUnknown()) {
              device.mVerified=MXDeviceInfo.DEVICE_VERIFICATION_UNVERIFIED;
              isUpdated=true;
            }
          }
          if (isUpdated) {
            mCryptoStore.storeUserDevices(userId,storedDeviceIDs);
          }
        }
      }
      if (null != callback) {
        getUIHandler().post(new Runnable(){
          @Override public void run(){
            callback.onSuccess(null);
          }
        }
);
      }
    }
  }
);
}