Program: 83944
Project: 83944
Buggy source:
public void run(){
  ObjectInputStream incoming=null;
  ObjectOutputStream outgoing=null;
  try {
    boolean keepRunning=true;
    while (keepRunning) {
      logger.info("String_Node_Str");
      Socket s=server.accept();
      incoming=new ObjectInputStream(s.getInputStream());
      outgoing=new ObjectOutputStream(s.getOutputStream());
      RouterCommand cmd=(RouterCommand)incoming.readObject();
      RouterCommand cmdrep=null;
switch (cmd.type) {
case PUSH:
        if (cmd.sourcepath != null && cmd.data != null && cmd.units != null)         sendDataToParents(cmd.sourcepath,cmd.data,cmd.units);
      cmdrep=new RouterCommand(RouterCommand.CommandType.PUSH_ACK);
    outgoing.writeObject(cmdrep);
  outgoing.flush();
break;
case PULL:
logger.info("String_Node_Str");
String reply=null;
if (cmd.lowts > 0 && cmd.hights > 0 && cmd.sourcepath != null && cmd.units != null) reply=pullFromNode(cmd.sourcepath,cmd.aggType,cmd.units,cmd.lowts,cmd.hights);
 else reply=pullFromNode(cmd.sourcepath,cmd.aggType,cmd.units,cmd.data);
logger.info("String_Node_Str" + reply);
cmdrep=new RouterCommand(RouterCommand.CommandType.PULL_ACK);
cmdrep.data=reply;
outgoing.writeObject(cmdrep);
outgoing.flush();
break;
case ADD_NODE:
logger.info("String_Node_Str");
if (cmd.sourcepath != null) addNodeEvent(cmd.sourcepath);
cmdrep=new RouterCommand(RouterCommand.CommandType.ADD_NODE_ACK);
outgoing.writeObject(cmdrep);
outgoing.flush();
break;
case REMOVE_NODE:
if (cmd.sourcepath != null) removeNodeEvent(cmd.sourcepath);
cmdrep=new RouterCommand(RouterCommand.CommandType.REMOVE_NODE_ACK);
outgoing.writeObject(cmdrep);
outgoing.flush();
break;
case ADD_LINK:
logger.info("String_Node_Str");
if (cmd.sourcepath != null && cmd.destpath != null) createLink(cmd.sourcepath,cmd.destpath);
cmdrep=new RouterCommand(RouterCommand.CommandType.ADD_LINK_ACK);
outgoing.writeObject(cmdrep);
outgoing.flush();
break;
case REMOVE_LINK:
if (cmd.sourcepath != null && cmd.destpath != null) removeLink(cmd.sourcepath,cmd.destpath);
cmdrep=new RouterCommand(RouterCommand.CommandType.REMOVE_LINK_ACK);
outgoing.writeObject(cmdrep);
outgoing.flush();
break;
case CREATE_AGG_PNT:
if (cmd.sourcepath != null && cmd.units != null) {
setUnitAndTypeAtPath(cmd.sourcepath,cmd.units,ProcType.AGGREGATE,cmd.state);
cmdrep=new RouterCommand(RouterCommand.CommandType.CREATE_AGG_PNT_ACK);
outgoing.writeObject(cmdrep);
outgoing.flush();
}
break;
case STOP_ROUTER:
keepRunning=false;
break;
}
}
}
 catch (Exception e) {
logger.log(Level.SEVERE,"String_Node_Str",e);
System.exit(1);
}
 finally {
try {
incoming.close();
}
 catch (Exception i) {
}
try {
outgoing.close();
}
 catch (Exception o) {
}
}
return;
}

Fixed version (ground truth):
public void run(){
  ObjectInputStream incoming=null;
  ObjectOutputStream outgoing=null;
  Socket s=null;
  try {
    boolean keepRunning=true;
    while (keepRunning) {
      logger.info("String_Node_Str");
      s=server.accept();
      incoming=new ObjectInputStream(s.getInputStream());
      outgoing=new ObjectOutputStream(s.getOutputStream());
      RouterCommand cmd=(RouterCommand)incoming.readObject();
      RouterCommand cmdrep=null;
switch (cmd.type) {
case PUSH:
        if (cmd.sourcepath != null && cmd.data != null && cmd.units != null)         sendDataToParents(cmd.sourcepath,cmd.data,cmd.units);
      cmdrep=new RouterCommand(RouterCommand.CommandType.PUSH_ACK);
    outgoing.writeObject(cmdrep);
  outgoing.flush();
break;
case PULL:
logger.info("String_Node_Str");
String reply=null;
if (cmd.lowts > 0 && cmd.hights > 0 && cmd.sourcepath != null && cmd.units != null) reply=pullFromNode(cmd.sourcepath,cmd.aggType,cmd.units,cmd.lowts,cmd.hights);
 else reply=pullFromNode(cmd.sourcepath,cmd.aggType,cmd.units,cmd.data);
logger.info("String_Node_Str" + reply);
cmdrep=new RouterCommand(RouterCommand.CommandType.PULL_ACK);
cmdrep.data=reply;
outgoing.writeObject(cmdrep);
outgoing.flush();
break;
case ADD_NODE:
logger.info("String_Node_Str");
if (cmd.sourcepath != null) addNodeEvent(cmd.sourcepath);
cmdrep=new RouterCommand(RouterCommand.CommandType.ADD_NODE_ACK);
outgoing.writeObject(cmdrep);
outgoing.flush();
break;
case REMOVE_NODE:
if (cmd.sourcepath != null) removeNodeEvent(cmd.sourcepath);
cmdrep=new RouterCommand(RouterCommand.CommandType.REMOVE_NODE_ACK);
outgoing.writeObject(cmdrep);
outgoing.flush();
break;
case ADD_LINK:
logger.info("String_Node_Str");
if (cmd.sourcepath != null && cmd.destpath != null) createLink(cmd.sourcepath,cmd.destpath);
cmdrep=new RouterCommand(RouterCommand.CommandType.ADD_LINK_ACK);
outgoing.writeObject(cmdrep);
outgoing.flush();
break;
case REMOVE_LINK:
if (cmd.sourcepath != null && cmd.destpath != null) removeLink(cmd.sourcepath,cmd.destpath);
cmdrep=new RouterCommand(RouterCommand.CommandType.REMOVE_LINK_ACK);
outgoing.writeObject(cmdrep);
outgoing.flush();
break;
case CREATE_AGG_PNT:
if (cmd.sourcepath != null && cmd.units != null) {
setUnitAndTypeAtPath(cmd.sourcepath,cmd.units,ProcType.AGGREGATE,cmd.state);
cmdrep=new RouterCommand(RouterCommand.CommandType.CREATE_AGG_PNT_ACK);
outgoing.writeObject(cmdrep);
outgoing.flush();
}
break;
case STOP_ROUTER:
keepRunning=false;
break;
}
}
}
 catch (Exception e) {
logger.log(Level.SEVERE,"String_Node_Str",e);
System.exit(1);
}
 finally {
try {
incoming.close();
}
 catch (Exception i) {
logger.log(Level.WARNING,"String_Node_Str",i);
}
try {
outgoing.close();
}
 catch (Exception o) {
logger.log(Level.WARNING,"String_Node_Str",o);
}
try {
s.close();
}
 catch (Exception se) {
logger.log(Level.WARNING,"String_Node_Str",se);
}
}
return;
}