Program: 12189
Project: 12189
Buggy source:
private void readNodeAndChildren(DataInputStream dis,ReteNode parent,List<Symbol> symbolMap,List<AlphaMemory> alphaMemories) throws IOException, SoarException {
  final ReteNodeType type=ReteNodeType.valueOf(dis.readUTF());
  ReteNode New=null;
  AlphaMemory am;
  boolean left_unlinked_flag;
  ReteTest other_tests;
  Production prod;
  VarLocation left_hash_loc=new VarLocation(-1,-1);
switch (type) {
case MEMORY_BNODE:
    left_hash_loc=new VarLocation(dis.readInt(),dis.readInt());
case UNHASHED_MEMORY_BNODE:
  New=ReteNode.make_new_mem_node(rete,parent,type,left_hash_loc);
break;
case MP_BNODE:
left_hash_loc=new VarLocation(dis.readInt(),dis.readInt());
case UNHASHED_MP_BNODE:
am=alphaMemories.get(dis.readInt());
am.reference_count++;
other_tests=readTestList(dis,symbolMap,alphaMemories);
left_unlinked_flag=dis.readBoolean();
New=ReteNode.make_new_mp_node(rete,parent,type,left_hash_loc,am,other_tests,left_unlinked_flag);
break;
case POSITIVE_BNODE:
case UNHASHED_POSITIVE_BNODE:
am=alphaMemories.get(dis.readInt());
am.reference_count++;
other_tests=readTestList(dis,symbolMap,alphaMemories);
left_unlinked_flag=dis.readBoolean();
New=ReteNode.make_new_positive_node(rete,parent,type,am,other_tests,left_unlinked_flag);
break;
case NEGATIVE_BNODE:
left_hash_loc=new VarLocation(dis.readInt(),dis.readInt());
case UNHASHED_NEGATIVE_BNODE:
am=alphaMemories.get(dis.readInt());
am.reference_count++;
other_tests=readTestList(dis,symbolMap,alphaMemories);
New=ReteNode.make_new_negative_node(rete,parent,type,left_hash_loc,am,other_tests);
break;
case CN_PARTNER_BNODE:
int count=dis.readInt();
ReteNode ncc_top=parent;
while (count-- > 0) ncc_top=ncc_top.real_parent_node();
New=ReteNode.make_new_cn_node(rete,ncc_top,parent);
break;
case P_BNODE:
String name=dis.readUTF();
String doc=dis.readUTF();
ProductionType prodType=ProductionType.valueOf(dis.readUTF());
Support declaredSupport=Support.valueOf(dis.readUTF());
Action actionList=readActionList(dis,symbolMap,alphaMemories);
prod=Production.newBuilder().name(name).documentation(doc).type(prodType).support(declaredSupport).actions(actionList).build();
int numUnboundVariables=dis.readInt();
rete.update_max_rhs_unbound_variables(numUnboundVariables);
for (int i=0; i < numUnboundVariables; i++) {
prod.getRhsUnboundVariables().add((Variable)symbolMap.get(dis.readInt()));
}
New=ReteNode.make_new_production_node(rete,parent,prod);
if (dis.readBoolean()) {
New.b_p().parents_nvn=readNodeVarNames(dis,parent,symbolMap);
}
 else {
New.b_p().parents_nvn=null;
}
rete.update_node_with_matches_from_above(New);
context.getEvents().fireEvent(new ProductionAddedEvent(context,prod));
break;
}
int count=dis.readInt();
while (count-- > 0) readNodeAndChildren(dis,New,symbolMap,alphaMemories);
}

Fixed version (ground truth):
private void readNodeAndChildren(DataInputStream dis,ReteNode parent,List<Symbol> symbolMap,List<AlphaMemory> alphaMemories) throws IOException, SoarException {
  final ReteNodeType type=ReteNodeType.valueOf(dis.readUTF());
  ReteNode New=null;
  AlphaMemory am;
  boolean left_unlinked_flag;
  ReteTest other_tests;
  Production prod;
  VarLocation left_hash_loc=new VarLocation(-1,-1);
switch (type) {
case MEMORY_BNODE:
    left_hash_loc=readLeftHashLoc(dis);
case UNHASHED_MEMORY_BNODE:
  New=ReteNode.make_new_mem_node(rete,parent,type,left_hash_loc);
break;
case MP_BNODE:
left_hash_loc=readLeftHashLoc(dis);
case UNHASHED_MP_BNODE:
am=alphaMemories.get(dis.readInt());
am.reference_count++;
other_tests=readTestList(dis,symbolMap,alphaMemories);
left_unlinked_flag=dis.readBoolean();
New=ReteNode.make_new_mp_node(rete,parent,type,left_hash_loc,am,other_tests,left_unlinked_flag);
break;
case POSITIVE_BNODE:
case UNHASHED_POSITIVE_BNODE:
am=alphaMemories.get(dis.readInt());
am.reference_count++;
other_tests=readTestList(dis,symbolMap,alphaMemories);
left_unlinked_flag=dis.readBoolean();
New=ReteNode.make_new_positive_node(rete,parent,type,am,other_tests,left_unlinked_flag);
break;
case NEGATIVE_BNODE:
left_hash_loc=readLeftHashLoc(dis);
case UNHASHED_NEGATIVE_BNODE:
am=alphaMemories.get(dis.readInt());
am.reference_count++;
other_tests=readTestList(dis,symbolMap,alphaMemories);
New=ReteNode.make_new_negative_node(rete,parent,type,left_hash_loc,am,other_tests);
break;
case CN_PARTNER_BNODE:
int count=dis.readInt();
ReteNode ncc_top=parent;
while (count-- > 0) ncc_top=ncc_top.real_parent_node();
New=ReteNode.make_new_cn_node(rete,ncc_top,parent);
break;
case P_BNODE:
String name=dis.readUTF();
String doc=dis.readUTF();
ProductionType prodType=ProductionType.valueOf(dis.readUTF());
Support declaredSupport=Support.valueOf(dis.readUTF());
Action actionList=readActionList(dis,symbolMap,alphaMemories);
prod=Production.newBuilder().name(name).documentation(doc).type(prodType).support(declaredSupport).actions(actionList).build();
int numUnboundVariables=dis.readInt();
rete.update_max_rhs_unbound_variables(numUnboundVariables);
List<Variable> unboundVars=new ArrayList<Variable>(numUnboundVariables);
for (int i=0; i < numUnboundVariables; i++) {
unboundVars.add(getSymbol(symbolMap,dis.readInt()).asVariable());
}
prod.setRhsUnboundVariables(unboundVars);
productionManager.addProductionToNameTypeMaps(prod);
rl.addProduction(prod);
New=ReteNode.make_new_production_node(rete,parent,prod);
if (dis.readBoolean()) {
New.b_p().parents_nvn=readNodeVarNames(dis,parent,symbolMap);
}
 else {
New.b_p().parents_nvn=null;
}
rete.update_node_with_matches_from_above(New);
context.getEvents().fireEvent(new ProductionAddedEvent(context,prod));
break;
}
int count=dis.readInt();
while (count-- > 0) readNodeAndChildren(dis,New,symbolMap,alphaMemories);
}