Program: 98013
Project: 98013
Buggy source:
/** 
 * Clean out the cache after commit. TODO keep hollow objects? E.g. references to correct, e.t.c!
 */
public void postCommit(boolean retainValues,boolean detachAllOnCommit){
  for (  ZooPC co : deletedObjects.values()) {
    if (co.jdoZooIsDeleted()) {
      objs.remove(co.jdoZooGetOid());
      co.jdoZooGetContext().notifyEvent(co,ZooInstanceEvent.POST_DELETE);
    }
  }
  if (detachAllOnCommit) {
    Iterator<ZooPC> it=objs.values().iterator();
    while (it.hasNext()) {
      ZooPC co=it.next();
      if (co instanceof ZooClassDef) {
        co.jdoZooMarkClean();
        co.jdoZooGetContext().notifyEvent(co,ZooInstanceEvent.POST_STORE);
      }
 else {
        co.jdoZooGetContext().notifyEvent(co,ZooInstanceEvent.PRE_DETACH);
        if (co.jdoZooIsStateHollow()) {
          co.jdoZooGetNode().refreshObject(co);
        }
        co.jdoZooMarkDetached();
        it.remove();
        co.jdoZooGetContext().notifyEvent(co,ZooInstanceEvent.POST_DETACH);
      }
    }
  }
 else   if (retainValues) {
    for (    ZooPC co : dirtyObjects) {
      if (!co.jdoZooIsDeleted()) {
        co.jdoZooMarkClean();
      }
    }
  }
 else {
    if (objs.size() > 100000) {
      DBLogger.debugPrintln(0,"String_Node_Str" + "String_Node_Str");
    }
    for (    ZooPC co : objs.values()) {
      if (retainValues || co instanceof ZooClassDef) {
        co.jdoZooMarkClean();
      }
 else {
        co.jdoZooEvict();
      }
      co.jdoZooGetContext().notifyEvent(co,ZooInstanceEvent.POST_STORE);
    }
  }
  dirtyObjects.clear();
  deletedObjects.clear();
  for (  GenericObject go : dirtyGenObjects) {
    if (go.jdoZooIsDeleted()) {
      genericObjects.remove(go.getOid());
      continue;
    }
    go.jdoZooMarkClean();
  }
  for (  GenericObject go : genericObjects.values()) {
    if (!retainValues) {
      go.jdoZooMarkHollow();
    }
  }
  dirtyGenObjects.clear();
  Iterator<ZooClassDef> iterS=schemata.values().iterator();
  for (; iterS.hasNext(); ) {
    ZooClassDef cs=iterS.next();
    if (cs.jdoZooIsDeleted()) {
      iterS.remove();
      nodeSchemata.get(cs.jdoZooGetNode()).remove(cs.getJavaClass());
      continue;
    }
    cs.jdoZooMarkClean();
  }
}

Fixed version (ground truth):
/** 
 * Clean out the cache after commit. TODO keep hollow objects? E.g. references to correct, e.t.c!
 */
public void postCommit(boolean retainValues,boolean detachAllOnCommit){
  if (!deletedObjects.isEmpty()) {
    for (    ZooPC co : deletedObjects.values()) {
      if (co.jdoZooIsDeleted()) {
        objs.remove(co.jdoZooGetOid());
        co.jdoZooGetContext().notifyEvent(co,ZooInstanceEvent.POST_DELETE);
      }
    }
  }
  if (detachAllOnCommit) {
    Iterator<ZooPC> it=objs.values().iterator();
    while (it.hasNext()) {
      ZooPC co=it.next();
      if (co instanceof ZooClassDef) {
        co.jdoZooMarkClean();
        co.jdoZooGetContext().notifyEvent(co,ZooInstanceEvent.POST_STORE);
      }
 else {
        co.jdoZooGetContext().notifyEvent(co,ZooInstanceEvent.PRE_DETACH);
        if (co.jdoZooIsStateHollow()) {
          co.jdoZooGetNode().refreshObject(co);
        }
        co.jdoZooMarkDetached();
        it.remove();
        co.jdoZooGetContext().notifyEvent(co,ZooInstanceEvent.POST_DETACH);
      }
    }
  }
 else   if (retainValues) {
    if (!dirtyObjects.isEmpty()) {
      for (      ZooPC co : dirtyObjects) {
        if (!co.jdoZooIsDeleted()) {
          co.jdoZooMarkClean();
        }
      }
    }
  }
 else {
    if (objs.size() > 100000) {
      DBLogger.debugPrintln(0,"String_Node_Str" + "String_Node_Str");
    }
    for (    ZooPC co : objs.values()) {
      if (retainValues || co instanceof ZooClassDef) {
        co.jdoZooMarkClean();
      }
 else {
        co.jdoZooEvict();
      }
      co.jdoZooGetContext().notifyEvent(co,ZooInstanceEvent.POST_STORE);
    }
  }
  dirtyObjects.clear();
  deletedObjects.clear();
  if (!dirtyGenObjects.isEmpty()) {
    for (    GenericObject go : dirtyGenObjects) {
      if (go.jdoZooIsDeleted()) {
        genericObjects.remove(go.getOid());
        continue;
      }
      go.jdoZooMarkClean();
    }
  }
  if (!genericObjects.isEmpty()) {
    for (    GenericObject go : genericObjects.values()) {
      if (!retainValues) {
        go.jdoZooMarkHollow();
      }
    }
  }
  dirtyGenObjects.clear();
  Iterator<ZooClassDef> iterS=schemata.values().iterator();
  for (; iterS.hasNext(); ) {
    ZooClassDef cs=iterS.next();
    if (cs.jdoZooIsDeleted()) {
      iterS.remove();
      nodeSchemata.get(cs.jdoZooGetNode()).remove(cs.getJavaClass());
      continue;
    }
    cs.jdoZooMarkClean();
  }
}