Program: 98025
Project: 98025
Buggy source:
private void updateFieldIndices(){
  final ZooPC[] buffer=this.buffer;
  final int bufferCnt=this.bufferCnt;
  int iInd=-1;
  int iField=-1;
  for (  ZooFieldDef field : cls.getAllFields()) {
    iField++;
    if (!field.isIndexed()) {
      continue;
    }
    iInd++;
    SchemaIndexEntry schemaTop=node.getSchemaIE(field.getDeclaringType());
    LongLongIndex fieldInd=(LongLongIndex)schemaTop.getIndex(field);
    try {
      Field jField=field.getJavaField();
      for (int i=0; i < bufferCnt; i++) {
        ZooPC co=buffer[i];
        final long l;
        if (field.isString()) {
          String str=(String)jField.get(co);
          l=BitTools.toSortableLong(str);
        }
 else {
          l=SerializerTools.primitiveFieldToLong(co,jField,field.getPrimitiveType());
        }
        if (!co.jdoZooIsNew()) {
          long lOld=co.jdoZooGetBackup()[iInd];
          if (lOld == l) {
            continue;
          }
          fieldInd.removeLong(lOld,co.jdoZooGetOid());
        }
        if (field.isIndexUnique()) {
          if (!fieldInd.insertLongIfNotSet(l,co.jdoZooGetOid())) {
            if (fieldUpdateBuffer[iField] == null) {
              fieldUpdateBuffer[iField]=new ArrayList<Pair>();
            }
            fieldUpdateBuffer[iField].add(new Pair(co.jdoZooGetOid(),l));
          }
        }
 else {
          fieldInd.insertLong(l,co.jdoZooGetOid());
        }
      }
    }
 catch (    SecurityException e) {
      throw DBLogger.newFatal("String_Node_Str" + field.getName(),e);
    }
catch (    IllegalArgumentException e) {
      throw DBLogger.newFatal("String_Node_Str" + field.getName(),e);
    }
catch (    IllegalAccessException e) {
      throw DBLogger.newFatal("String_Node_Str" + field.getName(),e);
    }
  }
}

Fixed version (ground truth):
private void updateFieldIndices(){
  final ZooPC[] buffer=this.buffer;
  final int bufferCnt=this.bufferCnt;
  int iInd=-1;
  int iField=-1;
  for (  ZooFieldDef field : cls.getAllFields()) {
    iField++;
    if (!field.isIndexed()) {
      continue;
    }
    iInd++;
    SchemaIndexEntry schemaTop=node.getSchemaIE(field.getDeclaringType());
    LongLongIndex fieldInd=(LongLongIndex)schemaTop.getIndex(field);
    try {
      Field jField=field.getJavaField();
      for (int i=0; i < bufferCnt; i++) {
        ZooPC co=buffer[i];
        final long l;
        String str=null;
        if (field.isString()) {
          str=(String)jField.get(co);
          l=BitTools.toSortableLong(str);
        }
 else {
          l=SerializerTools.primitiveFieldToLong(co,jField,field.getPrimitiveType());
        }
        if (!co.jdoZooIsNew()) {
          long lOld=co.jdoZooGetBackup().getA()[iInd];
          if (lOld == l) {
            if (field.isString()) {
              String str2=(String)co.jdoZooGetBackup().getB()[iInd];
              if ((str == null && str2 == null) || str.equals(str2)) {
                continue;
              }
            }
 else {
              continue;
            }
          }
          fieldInd.removeLong(lOld,co.jdoZooGetOid());
        }
        if (field.isIndexUnique()) {
          if (field.isString()) {
            bufferIndexUpdate(iField,co,l);
          }
 else {
            if (!fieldInd.insertLongIfNotSet(l,co.jdoZooGetOid())) {
              bufferIndexUpdate(iField,co,l);
            }
          }
        }
 else {
          fieldInd.insertLong(l,co.jdoZooGetOid());
        }
      }
    }
 catch (    SecurityException e) {
      throw DBLogger.newFatal("String_Node_Str" + field.getName(),e);
    }
catch (    IllegalArgumentException e) {
      throw DBLogger.newFatal("String_Node_Str" + field.getName(),e);
    }
catch (    IllegalAccessException e) {
      throw DBLogger.newFatal("String_Node_Str" + field.getName(),e);
    }
  }
}