Program: 182346
Project: 182346
Buggy source:
@Override public Entity getEntityAndIncrementCursor(Cursor cursor) throws RemoteException {
  final long eventId=cursor.getLong(cursor.getColumnIndexOrThrow(Events._ID));
  ContentValues cv=new ContentValues();
  cv.put(Events._ID,eventId);
  DatabaseUtils.cursorIntToContentValuesIfPresent(cursor,cv,CALENDAR_ID);
  DatabaseUtils.cursorStringToContentValuesIfPresent(cursor,cv,HTML_URI);
  DatabaseUtils.cursorStringToContentValuesIfPresent(cursor,cv,TITLE);
  DatabaseUtils.cursorStringToContentValuesIfPresent(cursor,cv,DESCRIPTION);
  DatabaseUtils.cursorStringToContentValuesIfPresent(cursor,cv,EVENT_LOCATION);
  DatabaseUtils.cursorIntToContentValuesIfPresent(cursor,cv,STATUS);
  DatabaseUtils.cursorIntToContentValuesIfPresent(cursor,cv,SELF_ATTENDEE_STATUS);
  DatabaseUtils.cursorStringToContentValuesIfPresent(cursor,cv,COMMENTS_URI);
  DatabaseUtils.cursorLongToContentValuesIfPresent(cursor,cv,DTSTART);
  DatabaseUtils.cursorLongToContentValuesIfPresent(cursor,cv,DTEND);
  DatabaseUtils.cursorStringToContentValuesIfPresent(cursor,cv,DURATION);
  DatabaseUtils.cursorStringToContentValuesIfPresent(cursor,cv,EVENT_TIMEZONE);
  DatabaseUtils.cursorStringToContentValuesIfPresent(cursor,cv,ALL_DAY);
  DatabaseUtils.cursorIntToContentValuesIfPresent(cursor,cv,VISIBILITY);
  DatabaseUtils.cursorIntToContentValuesIfPresent(cursor,cv,TRANSPARENCY);
  DatabaseUtils.cursorStringToContentValuesIfPresent(cursor,cv,HAS_ALARM);
  DatabaseUtils.cursorStringToContentValuesIfPresent(cursor,cv,HAS_EXTENDED_PROPERTIES);
  DatabaseUtils.cursorStringToContentValuesIfPresent(cursor,cv,RRULE);
  DatabaseUtils.cursorStringToContentValuesIfPresent(cursor,cv,RDATE);
  DatabaseUtils.cursorStringToContentValuesIfPresent(cursor,cv,EXRULE);
  DatabaseUtils.cursorStringToContentValuesIfPresent(cursor,cv,EXDATE);
  DatabaseUtils.cursorStringToContentValuesIfPresent(cursor,cv,ORIGINAL_EVENT);
  DatabaseUtils.cursorLongToContentValuesIfPresent(cursor,cv,ORIGINAL_INSTANCE_TIME);
  DatabaseUtils.cursorIntToContentValuesIfPresent(cursor,cv,ORIGINAL_ALL_DAY);
  DatabaseUtils.cursorLongToContentValuesIfPresent(cursor,cv,LAST_DATE);
  DatabaseUtils.cursorIntToContentValuesIfPresent(cursor,cv,HAS_ATTENDEE_DATA);
  DatabaseUtils.cursorIntToContentValuesIfPresent(cursor,cv,GUESTS_CAN_INVITE_OTHERS);
  DatabaseUtils.cursorIntToContentValuesIfPresent(cursor,cv,GUESTS_CAN_MODIFY);
  DatabaseUtils.cursorIntToContentValuesIfPresent(cursor,cv,GUESTS_CAN_SEE_GUESTS);
  DatabaseUtils.cursorStringToContentValuesIfPresent(cursor,cv,ORGANIZER);
  DatabaseUtils.cursorStringToContentValuesIfPresent(cursor,cv,_SYNC_ID);
  DatabaseUtils.cursorStringToContentValuesIfPresent(cursor,cv,_SYNC_DATA);
  DatabaseUtils.cursorLongToContentValuesIfPresent(cursor,cv,_SYNC_DIRTY);
  DatabaseUtils.cursorStringToContentValuesIfPresent(cursor,cv,_SYNC_VERSION);
  DatabaseUtils.cursorIntToContentValuesIfPresent(cursor,cv,DELETED);
  DatabaseUtils.cursorStringToContentValuesIfPresent(cursor,cv,Calendars.URL);
  Entity entity=new Entity(cv);
  Cursor subCursor;
  if (mResolver != null) {
    subCursor=mResolver.query(Reminders.CONTENT_URI,REMINDERS_PROJECTION,"String_Node_Str" + eventId,null,null);
  }
 else {
    subCursor=mProvider.query(Reminders.CONTENT_URI,REMINDERS_PROJECTION,"String_Node_Str" + eventId,null,null);
  }
  try {
    while (subCursor.moveToNext()) {
      ContentValues reminderValues=new ContentValues();
      reminderValues.put(Reminders.MINUTES,subCursor.getInt(COLUMN_MINUTES));
      reminderValues.put(Reminders.METHOD,subCursor.getInt(COLUMN_METHOD));
      entity.addSubValue(Reminders.CONTENT_URI,reminderValues);
    }
  }
  finally {
    subCursor.close();
  }
  if (mResolver != null) {
    subCursor=mResolver.query(Attendees.CONTENT_URI,ATTENDEES_PROJECTION,"String_Node_Str" + eventId,null,null);
  }
 else {
    subCursor=mProvider.query(Attendees.CONTENT_URI,ATTENDEES_PROJECTION,"String_Node_Str" + eventId,null,null);
  }
  try {
    while (subCursor.moveToNext()) {
      ContentValues attendeeValues=new ContentValues();
      attendeeValues.put(Attendees.ATTENDEE_NAME,subCursor.getString(COLUMN_ATTENDEE_NAME));
      attendeeValues.put(Attendees.ATTENDEE_EMAIL,subCursor.getString(COLUMN_ATTENDEE_EMAIL));
      attendeeValues.put(Attendees.ATTENDEE_RELATIONSHIP,subCursor.getInt(COLUMN_ATTENDEE_RELATIONSHIP));
      attendeeValues.put(Attendees.ATTENDEE_TYPE,subCursor.getInt(COLUMN_ATTENDEE_TYPE));
      attendeeValues.put(Attendees.ATTENDEE_STATUS,subCursor.getInt(COLUMN_ATTENDEE_STATUS));
      entity.addSubValue(Attendees.CONTENT_URI,attendeeValues);
    }
  }
  finally {
    subCursor.close();
  }
  if (mResolver != null) {
    subCursor=mResolver.query(ExtendedProperties.CONTENT_URI,EXTENDED_PROJECTION,"String_Node_Str" + eventId,null,null);
  }
 else {
    subCursor=mProvider.query(ExtendedProperties.CONTENT_URI,EXTENDED_PROJECTION,"String_Node_Str" + eventId,null,null);
  }
  try {
    while (subCursor.moveToNext()) {
      ContentValues extendedValues=new ContentValues();
      extendedValues.put(ExtendedProperties.NAME,subCursor.getString(COLUMN_NAME));
      extendedValues.put(ExtendedProperties.VALUE,subCursor.getString(COLUMN_VALUE));
      entity.addSubValue(ExtendedProperties.CONTENT_URI,extendedValues);
    }
  }
  finally {
    subCursor.close();
  }
  cursor.moveToNext();
  return entity;
}

Fixed version (ground truth):
@Override public Entity getEntityAndIncrementCursor(Cursor cursor) throws RemoteException {
  final long eventId=cursor.getLong(cursor.getColumnIndexOrThrow(Events._ID));
  ContentValues cv=new ContentValues();
  cv.put(Events._ID,eventId);
  DatabaseUtils.cursorIntToContentValuesIfPresent(cursor,cv,CALENDAR_ID);
  DatabaseUtils.cursorStringToContentValuesIfPresent(cursor,cv,HTML_URI);
  DatabaseUtils.cursorStringToContentValuesIfPresent(cursor,cv,TITLE);
  DatabaseUtils.cursorStringToContentValuesIfPresent(cursor,cv,DESCRIPTION);
  DatabaseUtils.cursorStringToContentValuesIfPresent(cursor,cv,EVENT_LOCATION);
  DatabaseUtils.cursorIntToContentValuesIfPresent(cursor,cv,STATUS);
  DatabaseUtils.cursorIntToContentValuesIfPresent(cursor,cv,SELF_ATTENDEE_STATUS);
  DatabaseUtils.cursorStringToContentValuesIfPresent(cursor,cv,COMMENTS_URI);
  DatabaseUtils.cursorLongToContentValuesIfPresent(cursor,cv,DTSTART);
  DatabaseUtils.cursorLongToContentValuesIfPresent(cursor,cv,DTEND);
  DatabaseUtils.cursorStringToContentValuesIfPresent(cursor,cv,DURATION);
  DatabaseUtils.cursorStringToContentValuesIfPresent(cursor,cv,EVENT_TIMEZONE);
  DatabaseUtils.cursorStringToContentValuesIfPresent(cursor,cv,ALL_DAY);
  DatabaseUtils.cursorIntToContentValuesIfPresent(cursor,cv,VISIBILITY);
  DatabaseUtils.cursorIntToContentValuesIfPresent(cursor,cv,TRANSPARENCY);
  DatabaseUtils.cursorStringToContentValuesIfPresent(cursor,cv,HAS_ALARM);
  DatabaseUtils.cursorStringToContentValuesIfPresent(cursor,cv,HAS_EXTENDED_PROPERTIES);
  DatabaseUtils.cursorStringToContentValuesIfPresent(cursor,cv,RRULE);
  DatabaseUtils.cursorStringToContentValuesIfPresent(cursor,cv,RDATE);
  DatabaseUtils.cursorStringToContentValuesIfPresent(cursor,cv,EXRULE);
  DatabaseUtils.cursorStringToContentValuesIfPresent(cursor,cv,EXDATE);
  DatabaseUtils.cursorStringToContentValuesIfPresent(cursor,cv,ORIGINAL_EVENT);
  DatabaseUtils.cursorLongToContentValuesIfPresent(cursor,cv,ORIGINAL_INSTANCE_TIME);
  DatabaseUtils.cursorIntToContentValuesIfPresent(cursor,cv,ORIGINAL_ALL_DAY);
  DatabaseUtils.cursorLongToContentValuesIfPresent(cursor,cv,LAST_DATE);
  DatabaseUtils.cursorIntToContentValuesIfPresent(cursor,cv,HAS_ATTENDEE_DATA);
  DatabaseUtils.cursorIntToContentValuesIfPresent(cursor,cv,GUESTS_CAN_INVITE_OTHERS);
  DatabaseUtils.cursorIntToContentValuesIfPresent(cursor,cv,GUESTS_CAN_MODIFY);
  DatabaseUtils.cursorIntToContentValuesIfPresent(cursor,cv,GUESTS_CAN_SEE_GUESTS);
  DatabaseUtils.cursorStringToContentValuesIfPresent(cursor,cv,ORGANIZER);
  DatabaseUtils.cursorStringToContentValuesIfPresent(cursor,cv,_SYNC_ID);
  DatabaseUtils.cursorStringToContentValuesIfPresent(cursor,cv,_SYNC_DATA);
  DatabaseUtils.cursorLongToContentValuesIfPresent(cursor,cv,_SYNC_DIRTY);
  DatabaseUtils.cursorStringToContentValuesIfPresent(cursor,cv,_SYNC_VERSION);
  DatabaseUtils.cursorIntToContentValuesIfPresent(cursor,cv,DELETED);
  DatabaseUtils.cursorStringToContentValuesIfPresent(cursor,cv,Calendars.URL);
  Entity entity=new Entity(cv);
  Cursor subCursor;
  if (mResolver != null) {
    subCursor=mResolver.query(Reminders.CONTENT_URI,REMINDERS_PROJECTION,WHERE_EVENT_ID,new String[]{Long.toString(eventId)},null);
  }
 else {
    subCursor=mProvider.query(Reminders.CONTENT_URI,REMINDERS_PROJECTION,WHERE_EVENT_ID,new String[]{Long.toString(eventId)},null);
  }
  try {
    while (subCursor.moveToNext()) {
      ContentValues reminderValues=new ContentValues();
      reminderValues.put(Reminders.MINUTES,subCursor.getInt(COLUMN_MINUTES));
      reminderValues.put(Reminders.METHOD,subCursor.getInt(COLUMN_METHOD));
      entity.addSubValue(Reminders.CONTENT_URI,reminderValues);
    }
  }
  finally {
    subCursor.close();
  }
  if (mResolver != null) {
    subCursor=mResolver.query(Attendees.CONTENT_URI,ATTENDEES_PROJECTION,WHERE_EVENT_ID,new String[]{Long.toString(eventId)},null);
  }
 else {
    subCursor=mProvider.query(Attendees.CONTENT_URI,ATTENDEES_PROJECTION,WHERE_EVENT_ID,new String[]{Long.toString(eventId)},null);
  }
  try {
    while (subCursor.moveToNext()) {
      ContentValues attendeeValues=new ContentValues();
      attendeeValues.put(Attendees.ATTENDEE_NAME,subCursor.getString(COLUMN_ATTENDEE_NAME));
      attendeeValues.put(Attendees.ATTENDEE_EMAIL,subCursor.getString(COLUMN_ATTENDEE_EMAIL));
      attendeeValues.put(Attendees.ATTENDEE_RELATIONSHIP,subCursor.getInt(COLUMN_ATTENDEE_RELATIONSHIP));
      attendeeValues.put(Attendees.ATTENDEE_TYPE,subCursor.getInt(COLUMN_ATTENDEE_TYPE));
      attendeeValues.put(Attendees.ATTENDEE_STATUS,subCursor.getInt(COLUMN_ATTENDEE_STATUS));
      entity.addSubValue(Attendees.CONTENT_URI,attendeeValues);
    }
  }
  finally {
    subCursor.close();
  }
  if (mResolver != null) {
    subCursor=mResolver.query(ExtendedProperties.CONTENT_URI,EXTENDED_PROJECTION,WHERE_EVENT_ID,new String[]{Long.toString(eventId)},null);
  }
 else {
    subCursor=mProvider.query(ExtendedProperties.CONTENT_URI,EXTENDED_PROJECTION,WHERE_EVENT_ID,new String[]{Long.toString(eventId)},null);
  }
  try {
    while (subCursor.moveToNext()) {
      ContentValues extendedValues=new ContentValues();
      extendedValues.put(ExtendedProperties.NAME,subCursor.getString(COLUMN_NAME));
      extendedValues.put(ExtendedProperties.VALUE,subCursor.getString(COLUMN_VALUE));
      entity.addSubValue(ExtendedProperties.CONTENT_URI,extendedValues);
    }
  }
  finally {
    subCursor.close();
  }
  cursor.moveToNext();
  return entity;
}