Program: 98201
Project: 98201
Buggy source:
@Override public void writeObjects(ZooClassDef clsDef,ArrayList<PersistenceCapableImpl> cachedObjects){
  if (cachedObjects.isEmpty()) {
    return;
  }
  SchemaIndexEntry schema=schemaIndex.getSchema(clsDef.getOid());
  if (schema == null) {
    throw new JDOFatalDataStoreException("String_Node_Str" + clsDef.getClassName());
  }
  PagedPosIndex posIndex=schema.getObjectIndex();
  objectWriter.newPage(posIndex,schema.getOID());
  DataSerializer dSer=new DataSerializer(objectWriter,cache,node);
  for (  PersistenceCapableImpl obj : cachedObjects) {
    long oid=obj.jdoZooGetOid();
    try {
      objectWriter.startObject(oid);
      dSer.writeObject(obj,clsDef,oid);
      objectWriter.finishObject();
    }
 catch (    Exception e) {
      throw new JDOFatalDataStoreException("String_Node_Str" + Util.oidToString(oid),e);
    }
  }
  int iInd=-1;
  for (  ZooFieldDef field : clsDef.getAllFields()) {
    if (!field.isIndexed()) {
      continue;
    }
    iInd++;
    SchemaIndexEntry schemaTop=schemaIndex.getSchema(field.getDeclaringType().getOid());
    LongLongIndex fieldInd=(LongLongIndex)schemaTop.getIndex(field);
    try {
      Field jField=field.getJavaField();
      if (field.isString()) {
        for (        PersistenceCapableImpl co : cachedObjects) {
          if (!co.jdoZooIsNew()) {
            long l=co.jdoZooGetBackup()[iInd];
            fieldInd.removeLong(l,co.jdoZooGetOid());
          }
          String str=(String)jField.get(co);
          if (str != null) {
            long l=BitTools.toSortableLong(str);
            fieldInd.insertLong(l,co.jdoZooGetOid());
          }
 else {
            fieldInd.insertLong(DataDeSerializerNoClass.NULL,co.jdoZooGetOid());
          }
        }
      }
 else {
switch (field.getPrimitiveType()) {
case BOOLEAN:
          for (          PersistenceCapableImpl co : cachedObjects) {
            if (!co.jdoZooIsNew()) {
              long l=co.jdoZooGetBackup()[iInd];
              fieldInd.removeLong(l,co.jdoZooGetOid());
            }
            fieldInd.insertLong(jField.getBoolean(co) ? 1 : 0,co.jdoZooGetOid());
          }
        break;
case BYTE:
      for (      PersistenceCapableImpl co : cachedObjects) {
        if (!co.jdoZooIsNew()) {
          long l=co.jdoZooGetBackup()[iInd];
          fieldInd.removeLong(l,co.jdoZooGetOid());
        }
        fieldInd.insertLong(jField.getByte(co),co.jdoZooGetOid());
      }
    break;
case DOUBLE:
  System.out.println("String_Node_Str");
break;
case FLOAT:
System.out.println("String_Node_Str");
break;
case INT:
for (PersistenceCapableImpl co : cachedObjects) {
if (!co.jdoZooIsNew()) {
long l=co.jdoZooGetBackup()[iInd];
fieldInd.removeLong(l,co.jdoZooGetOid());
}
fieldInd.insertLong(jField.getInt(co),co.jdoZooGetOid());
}
break;
case LONG:
for (PersistenceCapableImpl co : cachedObjects) {
if (!co.jdoZooIsNew()) {
long l=co.jdoZooGetBackup()[iInd];
fieldInd.removeLong(l,co.jdoZooGetOid());
}
fieldInd.insertLong(jField.getLong(co),co.jdoZooGetOid());
}
break;
case SHORT:
for (PersistenceCapableImpl co : cachedObjects) {
if (!co.jdoZooIsNew()) {
long l=co.jdoZooGetBackup()[iInd];
fieldInd.removeLong(l,co.jdoZooGetOid());
}
fieldInd.insertLong(jField.getShort(co),co.jdoZooGetOid());
}
break;
default :
throw new IllegalArgumentException("String_Node_Str" + field.getPrimitiveType());
}
}
}
 catch (SecurityException e) {
throw new JDOFatalDataStoreException("String_Node_Str" + field.getName(),e);
}
catch (IllegalArgumentException e) {
throw new JDOFatalDataStoreException("String_Node_Str" + field.getName(),e);
}
catch (IllegalAccessException e) {
throw new JDOFatalDataStoreException("String_Node_Str" + field.getName(),e);
}
}
}

Fixed version (ground truth):
@Override public void writeObjects(ZooClassDef clsDef,ArrayList<PersistenceCapableImpl> cachedObjects){
  if (cachedObjects.isEmpty()) {
    return;
  }
  SchemaIndexEntry schema=schemaIndex.getSchema(clsDef.getOid());
  if (schema == null) {
    throw new JDOFatalDataStoreException("String_Node_Str" + clsDef.getClassName());
  }
  PagedPosIndex posIndex=schema.getObjectIndex();
  objectWriter.newPage(posIndex,schema.getOID());
  DataSerializer dSer=new DataSerializer(objectWriter,cache,node);
  for (  PersistenceCapableImpl obj : cachedObjects) {
    long oid=obj.jdoZooGetOid();
    try {
      objectWriter.startObject(oid);
      dSer.writeObject(obj,clsDef,oid);
      objectWriter.finishObject();
    }
 catch (    Exception e) {
      throw new JDOFatalDataStoreException("String_Node_Str" + Util.oidToString(oid),e);
    }
  }
  int iInd=-1;
  for (  ZooFieldDef field : clsDef.getAllFields()) {
    if (!field.isIndexed()) {
      continue;
    }
    iInd++;
    SchemaIndexEntry schemaTop=schemaIndex.getSchema(field.getDeclaringType().getOid());
    LongLongIndex fieldInd=(LongLongIndex)schemaTop.getIndex(field);
    try {
      Field jField=field.getJavaField();
      if (field.isString()) {
        for (        PersistenceCapableImpl co : cachedObjects) {
          if (!co.jdoZooIsNew()) {
            long l=co.jdoZooGetBackup()[iInd];
            fieldInd.removeLong(l,co.jdoZooGetOid());
          }
          String str=(String)jField.get(co);
          if (str != null) {
            long l=BitTools.toSortableLong(str);
            fieldInd.insertLong(l,co.jdoZooGetOid());
          }
 else {
            fieldInd.insertLong(DataDeSerializerNoClass.NULL,co.jdoZooGetOid());
          }
        }
      }
 else {
switch (field.getPrimitiveType()) {
case BOOLEAN:
          for (          PersistenceCapableImpl co : cachedObjects) {
            if (!co.jdoZooIsNew()) {
              long l=co.jdoZooGetBackup()[iInd];
              fieldInd.removeLong(l,co.jdoZooGetOid());
            }
            fieldInd.insertLong(jField.getBoolean(co) ? 1 : 0,co.jdoZooGetOid());
          }
        break;
case BYTE:
      for (      PersistenceCapableImpl co : cachedObjects) {
        if (!co.jdoZooIsNew()) {
          long l=co.jdoZooGetBackup()[iInd];
          fieldInd.removeLong(l,co.jdoZooGetOid());
        }
        fieldInd.insertLong(jField.getByte(co),co.jdoZooGetOid());
      }
    break;
case CHAR:
  for (  PersistenceCapableImpl co : cachedObjects) {
    if (!co.jdoZooIsNew()) {
      long l=co.jdoZooGetBackup()[iInd];
      fieldInd.removeLong(l,co.jdoZooGetOid());
    }
    fieldInd.insertLong(jField.getChar(co),co.jdoZooGetOid());
  }
break;
case DOUBLE:
System.out.println("String_Node_Str");
break;
case FLOAT:
System.out.println("String_Node_Str");
break;
case INT:
for (PersistenceCapableImpl co : cachedObjects) {
if (!co.jdoZooIsNew()) {
long l=co.jdoZooGetBackup()[iInd];
fieldInd.removeLong(l,co.jdoZooGetOid());
}
fieldInd.insertLong(jField.getInt(co),co.jdoZooGetOid());
}
break;
case LONG:
for (PersistenceCapableImpl co : cachedObjects) {
if (!co.jdoZooIsNew()) {
long l=co.jdoZooGetBackup()[iInd];
fieldInd.removeLong(l,co.jdoZooGetOid());
}
fieldInd.insertLong(jField.getLong(co),co.jdoZooGetOid());
}
break;
case SHORT:
for (PersistenceCapableImpl co : cachedObjects) {
if (!co.jdoZooIsNew()) {
long l=co.jdoZooGetBackup()[iInd];
fieldInd.removeLong(l,co.jdoZooGetOid());
}
fieldInd.insertLong(jField.getShort(co),co.jdoZooGetOid());
}
break;
default :
throw new IllegalArgumentException("String_Node_Str" + field.getPrimitiveType());
}
}
}
 catch (SecurityException e) {
throw new JDOFatalDataStoreException("String_Node_Str" + field.getName(),e);
}
catch (IllegalArgumentException e) {
throw new JDOFatalDataStoreException("String_Node_Str" + field.getName(),e);
}
catch (IllegalAccessException e) {
throw new JDOFatalDataStoreException("String_Node_Str" + field.getName(),e);
}
}
}