Program: 98185
Project: 98185
Buggy source:
/** 
 * Schema versioning: We only create new schema instance when we add or remove fields. Renaming a field should not result in a new version! A new version is only required when the modified schema does not match the stored data. Such changes require also new versions of all sub-classes.  WHY? If every class stored only their own fields would we still have a problem? Yes, because the new version of the referenced superclass has a different OID.
 * @param cache 
 * @return New version.
 */
public ZooClassDef newVersion(ClientSessionCache cache){
  if (nextVersion != null) {
    throw new IllegalStateException();
  }
  long oid=jdoZooGetContext().getNode().getOidBuffer().allocateOid();
  ZooClassDef newDef=new ZooClassDef(className,oid,oidSuper);
  superDef.removeSubClass(this);
  newDef.associateSuperDef(superDef);
  cache.addSchema(newDef,false,jdoZooGetContext().getNode());
  newDef.prevVersionOid=jdoZooGetOid();
  newDef.prevVersion=this;
  nextVersion=newDef;
  newDef.apiHandle=apiHandle;
  if (apiHandle != null) {
    apiHandle.updateVersion(newDef);
  }
  apiHandle=null;
  newDef.providedContext=new PCContext(newDef,providedContext.getSession(),providedContext.getNode());
  for (  ZooFieldDef f : localFields) {
    ZooFieldDef fNew=new ZooFieldDef(newDef,f.getName(),f.getTypeName(),f.getJdoType());
    newDef.localFields.add(fNew);
    if (fNew.getApiHandle() != null) {
      fNew.getApiHandle().updateVersion(fNew);
    }
  }
  newDef.associateFields();
  for (  ZooClassDef sub : subs) {
    newDef.subs.add(sub.newVersion(cache));
  }
  return newDef;
}

Fixed version (ground truth):
/** 
 * Schema versioning: We only create new schema instance when we add or remove fields. Renaming a field should not result in a new version! A new version is only required when the modified schema does not match the stored data. Such changes require also new versions of all sub-classes.  WHY? If every class stored only their own fields would we still have a problem? Yes, because the new version of the referenced superclass has a different OID.
 * @param cache 
 * @return New version.
 */
public ZooClassDef newVersion(ClientSessionCache cache){
  if (nextVersion != null) {
    throw new IllegalStateException();
  }
  long oid=jdoZooGetContext().getNode().getOidBuffer().allocateOid();
  ZooClassDef newDef=new ZooClassDef(className,oid,oidSuper);
  superDef.removeSubClass(this);
  newDef.associateSuperDef(superDef);
  System.out.println("String_Node_Str" + this.getOid() + "String_Node_Str"+ newDef.getOid());
  cache.addSchema(newDef,false,jdoZooGetContext().getNode());
  newDef.prevVersionOid=jdoZooGetOid();
  newDef.prevVersion=this;
  nextVersion=newDef;
  newDef.apiHandle=apiHandle;
  if (apiHandle != null) {
    apiHandle.updateVersion(newDef);
  }
  apiHandle=null;
  newDef.providedContext=new PCContext(newDef,providedContext.getSession(),providedContext.getNode());
  for (  ZooFieldDef f : localFields) {
    ZooFieldDef fNew=new ZooFieldDef(newDef,f.getName(),f.getTypeName(),f.getJdoType());
    newDef.localFields.add(fNew);
    if (fNew.getApiHandle() != null) {
      fNew.getApiHandle().updateVersion(fNew);
    }
  }
  newDef.associateFields();
  for (  ZooClassDef sub : subs) {
    newDef.subs.add(sub.newVersion(cache));
  }
  return newDef;
}